forked from peterkvt80/vbit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvb2
executable file
·38 lines (29 loc) · 988 Bytes
/
vb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# "vb2" Autogenerated by getvbit2
# This runs the VBIT2 teletext system
# to change the directory in which vbit2 looks for pages edit the line below
PAGESDIRECTORY=$HOME/spoteletext/pages
PID=$$
function exitgo {
kill `ps -o pid --no-headers --ppid $PID` >/dev/null 2>&1
rm /var/tmp/vbit2-go.pid
}
# create a pid file
if [ -f /var/tmp/vbit2-go.pid ]; then
OLDPID=`cat /var/tmp/vbit2-go.pid`
RESULT=`ps -ef | grep $OLDPID | grep "vb2"`
if [ -n "${RESULT}" ]; then
echo "Script already running"
exit 255
fi
fi
echo $PID > /var/tmp/vbit2-go.pid
trap exitgo EXIT
sudo $HOME/raspi-teletext/tvctl on
# This loop restarts the teletext server if it stops.
# To stop teletext you should kill this process and not vbit2 or raspi.
until $HOME/spoteletext/vbit2 2>/var/tmp/spoteletext --dir $PAGESDIRECTORY | $HOME/raspi-teletext/teletext -; do
trap 'exit' INT HUP TERM
echo "VBIT2 Server crashed with exit code 0. Respawning.." >&2
sleep 1
done