2 # Start/stop the tuer status updater.
5 # Provides: tuer_status
6 # Required-Start: $remote_fs $syslog $time $tuer_core
7 # Required-Stop: $remote_fs $syslog $time $tuer_core
8 # Default-Start: 2 3 4 5
12 EXE_TRACK=/flash/tuer/track-presence.py
13 EXE_UWEB=/flash/tuer/update-web-status.py
14 EXE_XMPP=/flash/tuer/update-xmpp-status.py
15 EXE_SWITCH=/flash/tuer/switch-power.py
16 EXE_SOUND=/flash/tuer/play-sound-status.py
18 CFG_TRACK=/flash/tuer/track-presence.cfg
19 CFG_UWEB=/flash/tuer/update-web-status.cfg
20 CFG_XMPP=/flash/tuer/update-xmpp-status.cfg
21 CFG_SWITCH=/flash/tuer/switch-power.cfg
22 CFG_SOUND=/flash/tuer/play-sound-status.cfg
26 PIDFILE_TRACK=${DIR_RUN}/track-presence.pid
27 PIDFILE_UWEB=${DIR_RUN}/update-web-status.pid
28 PIDFILE_XMPP=${DIR_RUN}/update-xmpp-status.pid
29 PIDFILE_SWITCH=${DIR_RUN}/switch-power.pid
30 PIDFILE_SOUND=${DIR_RUN}/play-sound-status.pid
32 test -f $EXE_TRACK || exit 1
33 test -f $EXE_UWEB || exit 1
34 test -f $EXE_XMPP || exit 1
35 test -f $EXE_SWITCH || exit 1
36 test -f $EXE_SOUND || exit 1
37 if [ ! -d $DIR_RUN ]; then
38 mkdir -p $DIR_RUN || exit 2
39 chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
42 . /lib/lsb/init-functions
44 # Read the system's locale and set cron's locale. This locale
45 # will be inherited by cron (used to set charset of emails)
46 # and tasks running under it.
50 log_daemon_msg "Starting door daemon" "track-presence"
51 start-stop-daemon --start --quiet --pidfile $PIDFILE_TRACK -b -m -c $DOOR_USR --name track-presence.py --startas $EXE_TRACK -- $CFG_TRACK
53 log_daemon_msg "Starting door daemon" "update-web-status"
54 start-stop-daemon --start --quiet --pidfile $PIDFILE_UWEB -b -m -c $DOOR_USR --name update-web-status.py --startas $EXE_UWEB -- $CFG_UWEB
56 log_daemon_msg "Starting door daemon" "update-xmpp-status"
57 start-stop-daemon --start --quiet --pidfile $PIDFILE_XMPP -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_XMPP -- $CFG_XMPP
59 log_daemon_msg "Starting door daemon" "switch-power"
60 start-stop-daemon --start --quiet --pidfile $PIDFILE_SWITCH -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_SWITCH -- $CFG_SWITCH
62 log_daemon_msg "Starting door daemon" "play-sound"
63 start-stop-daemon --start --quiet --pidfile $PIDFILE_SOUND -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_SOUND -- $CFG_SOUND
67 log_daemon_msg "Stopping door daemon" "update-web-status"
68 start-stop-daemon --stop --quiet --pidfile $PIDFILE_UWEB -m --retry TERM/1/TERM/1/KILL
70 log_daemon_msg "Stopping door daemon" "update-xmpp-status"
71 start-stop-daemon --stop --quiet --pidfile $PIDFILE_XMPP -m --retry TERM/1/TERM/1/KILL
73 log_daemon_msg "Stopping door daemon" "switch-power"
74 start-stop-daemon --stop --quiet --pidfile $PIDFILE_SWITCH -m --retry TERM/1/TERM/1/KILL
77 log_daemon_msg "Stopping door daemon" "play-sound"
78 start-stop-daemon --stop --quiet --pidfile $PIDFILE_SOUND -m --retry TERM/1/TERM/1/KILL
81 log_daemon_msg "Stopping door daemon" "track-presence"
82 start-stop-daemon --stop --quiet --pidfile $PIDFILE_TRACK -m --retry TERM/1/TERM/1/KILL
89 *) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"