--- /dev/null
+# common defaults for tuer_core and tuer_status
+
+DIR_RUN=/var/run/tuer
+DOOR_USR=tuer
+DOOR_GRP=nogroup
+
+DOOR_SOCKET=${DIR_RUN}/door_cmd.socket
+++ /dev/null
-#!/bin/sh
-# Start/stop the tuer daemon.
-#
-### BEGIN INIT INFO
-# Provides: tuer
-# Required-Start: $remote_fs $syslog $time
-# Required-Stop: $remote_fs $syslog $time
-# Default-Start: 2 3 4 5
-# Default-Stop: 1
-### END INIT INFO
-
-EXE_DOOR=/flash/tuer/door_daemon
-EXE_CARD=/flash/tuer/checkcard.pl
-EXE_UWEB=/flash/tuer/update-web-status.py
-EXE_XMPP=/flash/tuer/update-xmpp-status.py
-DIR_RUN=/var/run/tuer
-
-CFG_UWEB=/flash/tuer/update-web-status.cfg
-CFG_XMPP=/flash/tuer/update-xmpp-status.cfg
-
-DOOR_SOCKET=${DIR_RUN}/door_cmd.socket
-DOOR_DEV=/dev/door
-DOOR_LOG="--log syslog:3,door_daemon,local1"
-DOOR_USR=tuer
-DOOR_GRP=nogroup
-#DOOR_HOME=$DIR_RUN
-
-PIDFILE1=${DIR_RUN}/door_daemon.pid
-PIDFILE2=${DIR_RUN}/checkcard.pid
-PIDFILE3=${DIR_RUN}/update-web-status.pid
-PIDFILE4=${DIR_RUN}/update-xmpp-status.pid
-
-test -f $EXE_DOOR || exit 1
-test -f $EXE_CARD || exit 1
-if [ ! -d $DIR_RUN ]; then
- mkdir -p $DIR_RUN || exit 2
- chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
-fi
-chown $DOOR_USR:$DOOR_GRP $DOOR_DEV
-
-. /lib/lsb/init-functions
-
-# Read the system's locale and set cron's locale. This locale
-# will be inherited by cron (used to set charset of emails)
-# and tasks running under it.
-
-case "$1" in
-start)
- log_daemon_msg "Starting door daemon" "door_daemon"
- start-stop-daemon --start --quiet --pidfile $PIDFILE1 --name door_daemon --startas $EXE_DOOR -- -d $DOOR_DEV -s $DOOR_SOCKET -u $DOOR_USR -g $DOOR_GRP -P $PIDFILE1 $DOOR_LOG
- log_end_msg $?
- log_daemon_msg "Starting door daemon" "checkcard"
- start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
- #start-stop-daemon --start --quiet --pidfile $PIDFILE2 -c $DOOR_USR -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
- log_end_msg $?
- log_daemon_msg "Starting door daemon" "update-web-status"
- start-stop-daemon --start --quiet --pidfile $PIDFILE3 -b -m -c $DOOR_USR --name update-web-status.py --startas $EXE_UWEB -- $DOOR_SOCKET $CFG_UWEB
- log_end_msg $?
- log_daemon_msg "Starting door daemon" "update-xmpp-status"
- start-stop-daemon --start --quiet --pidfile $PIDFILE4 -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_XMPP -- $DOOR_SOCKET $CFG_XMPP
- log_end_msg $?
- ;;
-stop)
- log_daemon_msg "Stopping door daemon" "door_daemon"
- start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon
- log_end_msg $?
- log_daemon_msg "Stopping door daemon" "checkcard"
- start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl
- log_end_msg $?
- log_daemon_msg "Stopping door daemon" "update-web-status"
- start-stop-daemon --stop --quiet --pidfile $PIDFILE3 -m --retry TERM/1/TERM/1/KILL
- log_end_msg $?
- log_daemon_msg "Stopping door daemon" "update-xmpp-status"
- start-stop-daemon --stop --quiet --pidfile $PIDFILE4 -m --retry TERM/1/TERM/1/KILL
- log_end_msg $?
- killall "mifare-read" 2>/dev/null
- ;;
-restart)
- $0 stop
- $0 start
- ;;
-*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
- exit 2
- ;;
-esac
-exit 0
--- /dev/null
+#!/bin/sh
+# Start/stop the tuer daemon core.
+#
+### BEGIN INIT INFO
+# Provides: tuer_core
+# Required-Start: $remote_fs $syslog $time
+# Required-Stop: $remote_fs $syslog $time
+# Default-Start: 2 3 4 5
+# Default-Stop: 1
+### END INIT INFO
+
+EXE_DOOR=/flash/tuer/door_daemon
+EXE_CARD=/flash/tuer/checkcard.pl
+
+DOOR_LOG="--log syslog:3,door_daemon,local1"
+DOOR_DEV=/dev/door
+
+. /etc/default/tuer
+
+PIDFILE_DOOR=${DIR_RUN}/door_daemon.pid
+PIDFILE_CARD=${DIR_RUN}/checkcard.pid
+
+test -f $EXE_DOOR || exit 1
+test -f $EXE_CARD || exit 1
+if [ ! -d $DIR_RUN ]; then
+ mkdir -p $DIR_RUN || exit 2
+ chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
+fi
+chown $DOOR_USR:$DOOR_GRP $DOOR_DEV
+
+. /lib/lsb/init-functions
+
+# Read the system's locale and set cron's locale. This locale
+# will be inherited by cron (used to set charset of emails)
+# and tasks running under it.
+
+case "$1" in
+start)
+ log_daemon_msg "Starting door daemon" "door_daemon"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE_DOOR --name door_daemon --startas $EXE_DOOR -- -d $DOOR_DEV -s $DOOR_SOCKET -u $DOOR_USR -g $DOOR_GRP -P $PIDFILE_DOOR $DOOR_LOG
+ log_end_msg $?
+ log_daemon_msg "Starting door daemon" "checkcard"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE_CARD -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
+ #start-stop-daemon --start --quiet --pidfile $PIDFILE_CARD -c $DOOR_USR -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
+ log_end_msg $?
+ ;;
+stop)
+ log_daemon_msg "Stopping door daemon" "door_daemon"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE_DOOR -m --name door_daemon
+ log_end_msg $?
+ log_daemon_msg "Stopping door daemon" "checkcard"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE_CARD -m --name checkcard.pl
+ log_end_msg $?
+ killall "mifare-read" 2>/dev/null
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 2
+ ;;
+esac
+exit 0
--- /dev/null
+#!/bin/sh
+# Start/stop the tuer status updater.
+#
+### BEGIN INIT INFO
+# Provides: tuer_status
+# Required-Start: $remote_fs $syslog $time $tuer_core
+# Required-Stop: $remote_fs $syslog $time $tuer_core
+# Default-Start: 2 3 4 5
+# Default-Stop: 1
+### END INIT INFO
+
+EXE_UWEB=/flash/tuer/update-web-status.py
+EXE_XMPP=/flash/tuer/update-xmpp-status.py
+
+CFG_UWEB=/flash/tuer/update-web-status.cfg
+CFG_XMPP=/flash/tuer/update-xmpp-status.cfg
+
+. /etc/default/tuer
+
+PIDFILE_UWEB=${DIR_RUN}/update-web-status.pid
+PIDFILE_XMPP=${DIR_RUN}/update-xmpp-status.pid
+
+test -f $EXE_UWEB || exit 1
+test -f $EXE_XMPP || exit 1
+if [ ! -d $DIR_RUN ]; then
+ mkdir -p $DIR_RUN || exit 2
+ chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
+fi
+
+. /lib/lsb/init-functions
+
+# Read the system's locale and set cron's locale. This locale
+# will be inherited by cron (used to set charset of emails)
+# and tasks running under it.
+
+case "$1" in
+start)
+ log_daemon_msg "Starting door daemon" "update-web-status"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE_UWEB -b -m -c $DOOR_USR --name update-web-status.py --startas $EXE_UWEB -- $DOOR_SOCKET $CFG_UWEB
+ log_end_msg $?
+ log_daemon_msg "Starting door daemon" "update-xmpp-status"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE_XMPP -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_XMPP -- $DOOR_SOCKET $CFG_XMPP
+ log_end_msg $?
+ ;;
+stop)
+ log_daemon_msg "Stopping door daemon" "update-web-status"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE_UWEB -m --retry TERM/1/TERM/1/KILL
+ log_end_msg $?
+ log_daemon_msg "Stopping door daemon" "update-xmpp-status"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE_XMPP -m --retry TERM/1/TERM/1/KILL
+ log_end_msg $?
+ ;;
+restart)
+ $0 stop
+ $0 start
+ ;;
+*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 2
+ ;;
+esac
+exit 0