X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=blobdiff_plain;f=on-vc.sh;h=e560ed45df42554b98ce1a1730757ea8ad0ff408;hb=HEAD;hp=54cc8126bc7e6af4abf15c0f46e9c407ddf4cdd1;hpb=f05ba8fd0c02d8998c0ba6663ed4f4b675886986;p=ircbot.git diff --git a/on-vc.sh b/on-vc.sh index 54cc812..e560ed4 100755 --- a/on-vc.sh +++ b/on-vc.sh @@ -1,25 +1,25 @@ #!/bin/sh # usage: -# .../on-vc.sh VC USERNAME SCRIPT +# .../on-vc.sh VC SCRIPT # must be invoked by full path to relevant directory # where -# ttyVC is the relevant tty -# it should be owned by USERNAME +# ttyVC is the relevant tty which should have good permissions # ./SCRIPT is the startup script (`repeatedly.sh', `startup.sh', etc.) # (in the directory whose fullpathname we're invoked with) set -e +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + fail () { echo 2>&1 "$0: $1"; exit 1; } -test $# = 3 || fail "usage: $0 VC USERNAME SCRIPT" +test $# -ge 2 || fail "usage: $0 VC SCRIPT [ARGS]" vc="$1" -username="$2" -script="$3" +script="$2" +shift; shift cd "$(dirname $0)" test -L .tclshrc || fail "no .tclshrc symlink" -text -x "./$script" || fail "script not executable" +test -x "./$script" || fail "script not executable" -openvt -c "$vc" -w -- \ - really -u "$username" screen ./"$script" +openvt -f -c "$vc" -w -- screen ./"$script" "$@"