chiark / gitweb /
topicedit: add a timeout; better error handling
[ircbot.git] / on-vc.sh
1 #!/bin/sh
2 # usage:
3 #    .../on-vc.sh VC SCRIPT
4 # must be invoked by full path to relevant directory
5 # where
6 #    ttyVC is the relevant tty which should have good permissions
7 #    ./SCRIPT is the startup script (`repeatedly.sh', `startup.sh', etc.)
8 #      (in the directory whose fullpathname we're invoked with)
9
10 set -e
11
12 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
13
14 fail () { echo 2>&1 "$0: $1"; exit 1; }
15
16 test $# -ge 2 || fail "usage: $0 VC SCRIPT [ARGS]"
17 vc="$1"
18 script="$2"
19 shift; shift
20
21 cd "$(dirname $0)"
22 test -L .tclshrc || fail "no .tclshrc symlink"
23 test -x "./$script" || fail "script not executable"
24
25 openvt -f -c "$vc" -w -- screen ./"$script" "$@"