add on-vc
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Jun 2002 22:51:35 +0000 (22:51 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Jun 2002 22:51:35 +0000 (22:51 +0000)
on-vc.sh [new file with mode: 0755]

diff --git a/on-vc.sh b/on-vc.sh
new file mode 100755 (executable)
index 0000000..9cd3ce8
--- /dev/null
+++ b/on-vc.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# usage:
+#    .../on-vc.sh VC USERNAME SCRIPT
+# must be invoked by full path to relevant directory
+# where
+#    ttyVC is the relevant tty
+#    it should be owned by USERNAME
+#    ./SCRIPT is the startup script (`repeatedly.sh', `startup.sh', etc.)
+#      (in the directory whose fullpathname we're invoked with)
+
+set -e
+
+fail () { echo 2>&1 "$0: $1" }
+
+test $# = 3 || fail "usage: $0 VC USERNAME SCRIPT"
+vc="$1"
+username="$2"
+script="$3"
+
+cd "$(dirname $0)"
+test -L .tclshrc || fail "no .tclshrc symlink"
+text -x "./$script" || fail "script not executable"
+
+openvt -c "$vc" -w -- \
+       really -u "$username" screen ./"$script"