a6449a1fb076eccab0cad675f7934735befd5b88
[svn42.git] / tuer
1 #!/bin/sh
2 # Start/stop the tuer daemon.
3 #
4 ### BEGIN INIT INFO
5 # Provides:          tuer
6 # Required-Start:    $remote_fs $syslog $time
7 # Required-Stop:     $remote_fs $syslog $time
8 # Default-Start:     2 3 4 5
9 # Default-Stop:      1
10 ### END INIT INFO
11
12
13 test -f /flash/tuer_python/door_daemon.py  || exit 0
14 test -f /flash/tuer_python/checkcard.pl  || exit 0
15
16 PIDFILE1=/var/run/door_daemon.pid
17 PIDFILE2=/var/run/checkcard.pid
18
19 . /lib/lsb/init-functions
20
21 # Read the system's locale and set cron's locale. This locale
22 # will be inherited by cron (used to set charset of emails)
23 # and tasks running under it.
24
25 case "$1" in
26 start)  
27         log_daemon_msg "Starting door daemon" "door_daemon"
28         start-stop-daemon --start --quiet --pidfile $PIDFILE1 -b -m --name door_daemon.py --startas /flash/tuer_python/door_daemon.py --
29         log_end_msg $?
30         log_daemon_msg "Starting door daemon" "checkcard"
31         start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas /flash/tuer_python/checkcard.pl --
32         log_end_msg $?  
33         ;;
34 stop)
35         log_daemon_msg "Stopping door daemon" "door_daemon"
36         start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon.py 
37         log_end_msg $?
38         log_daemon_msg "Stopping door daemon" "checkcard"
39         start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl
40         log_end_msg $?  
41         ;;
42 restart) 
43         $0 stop
44         $0 start
45         ;;
46 *)      log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
47         exit 2
48         ;;
49 esac
50 exit 0