chiark / gitweb /
Actually seems to work!
[ircbot] / on-vc.sh
CommitLineData
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
11set -e
12
8630943d 13fail () { echo 2>&1 "$0: $1"; exit 1; }
22368e4c
IJ
14
15test $# = 3 || fail "usage: $0 VC USERNAME SCRIPT"
16vc="$1"
17username="$2"
18script="$3"
19
20cd "$(dirname $0)"
21test -L .tclshrc || fail "no .tclshrc symlink"
b0ef02f8 22test -x "./$script" || fail "script not executable"
22368e4c 23
b0ef02f8
IJ
24really -u "$username" \
25 openvt -f -c "$vc" -w -- \
26 screen ./"$script"