From: Mitchell Pomery Date: Sun, 1 Mar 2015 15:00:00 +0000 (+0800) Subject: Fixed init script not working correctly X-Git-Url: https://git.ucc.asn.au/?p=uccvend-vendserver.git;a=commitdiff_plain;h=bebd1393c36f360b0a5e16289d699f02369f61fd Fixed init script not working correctly --- diff --git a/bin/init.d/vendserver b/bin/init.d/vendserver index 3390401..438bbf7 100755 --- a/bin/init.d/vendserver +++ b/bin/init.d/vendserver @@ -19,43 +19,45 @@ PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME DAEMON_ARGS="" -# Gracefully exit if the package has been removed. -test -x $DAEMON || exit 0 +# 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 --quiet --pidfile $PIDFILE \ - --nicelevel 5 \ - --exec $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \ + start-stop-daemon --start --pidfile $PIDFILE --nicelevel 5 \ + --startas $DAEMON -- -d -sdaemon --pid-file=$PIDFILE \ $DAEMON_ARGS } d_stop() { - start-stop-daemon --stop --quiet --pidfile $PIDFILE \ - --name $NAME + start-stop-daemon --stop --pidfile $PIDFILE } case "$1" in - start) - echo -n "Starting $DESC: $NAME" - d_start - echo "." - ;; - stop) - echo -n "Stopping $DESC: $NAME" - d_stop - echo "." - ;; - restart|force-reload) - echo -n "Restarting $DESC: $NAME" - d_stop - sleep 1 - d_start - echo "." - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; + 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