#! /bin/sh ### BEGIN INIT INFO # Provides: vendserver # Required-Start: $syslog # Required-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VendServer # Description: Dispense2 Vending Machine / MIFARE Server ### END INIT INFO # Author: Bob Adamson PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games DESC="VendServer" NAME=vendserver DAEMON="/usr/local/uccvend-vendserver/vendserver" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME DAEMON_ARGS="" # Say something and gracefully exit if the package has been removed. if ! test -x $DAEMON; then echo "Failed to find the executable $DAEMON" exit 1 fi d_start() { start-stop-daemon --start --pidfile $PIDFILE --nicelevel 5 \ --startas $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \ $DAEMON_ARGS } d_stop() { start-stop-daemon --stop --pidfile $PIDFILE } case "$1" in start) echo -n "Starting $DESC: $NAME\n" d_start echo "." ;; stop) echo -n "Stopping $DESC: $NAME\n" d_stop echo "." ;; restart|force-reload) echo -n "Restarting $DESC: $NAME\n" d_stop sleep 1 d_start echo "." ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0