From f93f0948e028c33694cf7f90c7d5918cbf27971c Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 27 Oct 2011 16:59:26 +0100 Subject: Fixed up initscripts. --- debian/mauvealert-server.init | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/debian/mauvealert-server.init b/debian/mauvealert-server.init index 1e48c68..592304f 100644 --- a/debian/mauvealert-server.init +++ b/debian/mauvealert-server.init @@ -59,8 +59,8 @@ do_start() count=0 while [ $((count = count + 1)) -le 5 ] ; do - echo -n . sleep 1 + # This is just a test to see if the daemon is running yet. start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON --chuid $RUNASUSER --test > /dev/null \ || return 0 done @@ -81,6 +81,7 @@ do_stop() start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $RUNASUSER RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks # and if the daemon is only ever run from this initscript. # If the above conditions are not satisfied then add some other code @@ -88,7 +89,9 @@ do_stop() # needed by services started subsequently. A last resort is to # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE --user $RUNASUSER - [ "$?" = 2 ] && return 2 + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return "$RETVAL" @@ -121,16 +124,16 @@ case "$1" in [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; esac ;; status) -- cgit v1.2.1