MIFARE Login - Add a blacklist of known-bad cards
[uccvend-vendserver.git] / bin / init.d / vendserver
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides:          vendserver
4 # Required-Start:    $syslog
5 # Required-Stop:     $syslog
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: VendServer
9 # Description:       Dispense2 Vending Machine / MIFARE Server
10 ### END INIT INFO
11
12 # Author: Bob Adamson
13
14 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games
15 DESC="VendServer"
16 NAME=vendserver
17 DAEMON="/usr/local/uccvend-vendserver/vendserver"
18 PIDFILE=/var/run/$NAME.pid
19 SCRIPTNAME=/etc/init.d/$NAME
20 DAEMON_ARGS=""
21
22 # Say something and gracefully exit if the package has been removed.
23 if ! test -x $DAEMON; then
24         echo "Failed to find the executable $DAEMON"
25         exit 1
26 fi
27
28
29 d_start() {
30         start-stop-daemon --start --pidfile $PIDFILE --nicelevel 5 \
31                 --startas $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \
32                 $DAEMON_ARGS
33 }
34
35 d_stop() {
36         start-stop-daemon --stop --pidfile $PIDFILE
37 }
38
39 case "$1" in
40         start)
41                 echo -n "Starting $DESC: $NAME\n"
42                 d_start
43                 echo "."
44                 ;;
45         stop)
46                 echo -n "Stopping $DESC: $NAME\n"
47                 d_stop
48                 echo "."
49                 ;;
50         restart|force-reload)
51                 echo -n "Restarting $DESC: $NAME\n"
52                 d_stop
53                 sleep 1
54                 d_start
55                 echo "."
56                 ;;
57         *)
58                 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
59                 exit 1
60                 ;;
61 esac
62
63 exit 0

UCC git Repository :: git.ucc.asn.au