+#!/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"