codekasten/fotokiosk/system-scripts/fotokiste
2008-08-23 12:31:08 +00:00

39 lines
828 B
Bash
Executable file

#!/bin/sh
set -u
FOTOKISTE_DIR="/usr/local/src/fotokiste"
FOTOKISTE_EXEC="start-fotokiste.py"
PID_FILE="/var/run/fotokiste.pid"
LOG_FILE="/var/log/fotokiste.log"
MJPG_STREAMER=/usr/local/src/mjpg-streamer/start-fotokiste.sh
LOG_FILE_MJPG=/var/log/mjpg-streamer.log
PID_FILE_MJPG=/var/run/mjpg-streamer.pid
case "$1" in
start)
echo -n "Starting Fotokiste ... "
"$MJPG_STREAMER" &>"$LOG_FILE_MJPG" </dev/null &
echo "$!" >"$PID_FILE_MJPG"
cd "$FOTOKISTE_DIR"; python "$FOTOKISTE_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