codekasten/fotokiosk/system-scripts/fotokiosk
2008-08-23 13:11:19 +00:00

39 lines
828 B
Bash
Executable file

#!/bin/sh
set -u
FOTOKIOSK_DIR="/usr/local/src/fotokiosk"
FOTOKIOSK_EXEC="start-fotokiosk.py"
PID_FILE="/var/run/fotokiosk.pid"
LOG_FILE="/var/log/fotokiosk.log"
MJPG_STREAMER=/usr/local/src/mjpg-streamer/start-fotokiosk.sh
LOG_FILE_MJPG=/var/log/mjpg-streamer.log
PID_FILE_MJPG=/var/run/mjpg-streamer.pid
case "$1" in
start)
echo -n "Starting Fotokiosk ... "
"$MJPG_STREAMER" &>"$LOG_FILE_MJPG" </dev/null &
echo "$!" >"$PID_FILE_MJPG"
cd "$FOTOKIOSK_DIR"; python "$FOTOKIOSK_EXEC" </dev/null &>"$LOG_FILE" &
echo "$!" >"$PID_FILE"
echo done
X &
export DISPLAY=:0
xhost +
sleep 30
su glasmensch /usr/bin/iceweasel &
;;
stop)
killall X
for pfile in "$PID_FILE" "$PID_FILE_MJPG"
do test -e "$pfile" && kill "$(cat "$pfile")"
rm -f "$pfile"
done
;;
restart)
"$0" stop
"$0" start
;;
esac
exit 0