2 # Start/stop the tuer daemon.
6 # Required-Start: $remote_fs $syslog $time
7 # Required-Stop: $remote_fs $syslog $time
8 # Default-Start: 2 3 4 5
12 EXE_DOOR=/flash/tuer/door_daemon
13 EXE_CARD=/flash/tuer/checkcard.pl
14 EXE_UWEB=/flash/tuer/update-web-status.py
17 DOOR_SOCKET=${DIR_RUN}/door_cmd.socket
19 DOOR_LOG="--log syslog:3,door_daemon,local1"
24 PIDFILE1=${DIR_RUN}/door_daemon.pid
25 PIDFILE2=${DIR_RUN}/checkcard.pid
26 PIDFILE3=${DIR_RUN}/update_web_status.pid
28 test -f $EXE_DOOR || exit 1
29 test -f $EXE_CARD || exit 1
30 if [ ! -d $DIR_RUN ]; then
31 mkdir -p $DIR_RUN || exit 2
32 chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
34 chown $DOOR_USR:$DOOR_GRP $DOOR_DEV
36 . /lib/lsb/init-functions
38 # Read the system's locale and set cron's locale. This locale
39 # will be inherited by cron (used to set charset of emails)
40 # and tasks running under it.
44 log_daemon_msg "Starting door daemon" "door_daemon"
45 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
47 log_daemon_msg "Starting door daemon" "checkcard"
48 start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
49 #start-stop-daemon --start --quiet --pidfile $PIDFILE2 -c $DOOR_USR -b -m --name checkcard.pl --startas $EXE_CARD -- $DOOR_SOCKET
51 log_daemon_msg "Starting door daemon" "update-web-status"
52 start-stop-daemon --start --quiet --pidfile $PIDFILE3 -b -m -c $DOOR_USR --name update-web-status.py --startas $EXE_UWEB -- $DOOR_SOCKET
56 log_daemon_msg "Stopping door daemon" "door_daemon"
57 start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon
59 log_daemon_msg "Stopping door daemon" "checkcard"
60 start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl
62 log_daemon_msg "Stopping door daemon" "update-web-status"
63 start-stop-daemon --stop --quiet --pidfile $PIDFILE3 -m --name update_web_status.py
65 killall "mifare-read" 2>/dev/null
71 *) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"