Commit | Line | Data |
---|---|---|
22368e4c IJ |
1 | #!/bin/sh |
2 | # usage: | |
3 | # .../on-vc.sh VC USERNAME SCRIPT | |
4 | # must be invoked by full path to relevant directory | |
5 | # where | |
6 | # ttyVC is the relevant tty | |
7 | # it should be owned by USERNAME | |
8 | # ./SCRIPT is the startup script (`repeatedly.sh', `startup.sh', etc.) | |
9 | # (in the directory whose fullpathname we're invoked with) | |
10 | ||
11 | set -e | |
12 | ||
8630943d | 13 | fail () { echo 2>&1 "$0: $1"; exit 1; } |
22368e4c IJ |
14 | |
15 | test $# = 3 || fail "usage: $0 VC USERNAME SCRIPT" | |
16 | vc="$1" | |
17 | username="$2" | |
18 | script="$3" | |
19 | ||
20 | cd "$(dirname $0)" | |
21 | test -L .tclshrc || fail "no .tclshrc symlink" | |
22 | text -x "./$script" || fail "script not executable" | |
23 | ||
24 | openvt -c "$vc" -w -- \ | |
25 | really -u "$username" screen ./"$script" |