aboutsummaryrefslogtreecommitdiff
path: root/debian/mauvealert-server.init
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-10-27 16:59:26 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-10-27 16:59:26 +0100
commitf93f0948e028c33694cf7f90c7d5918cbf27971c (patch)
tree7f29df41d85fb94ece590acdaf74a99f9b4e7c35 /debian/mauvealert-server.init
parent195ffe943614ac084839b590294ad740e4bb15d3 (diff)
Fixed up initscripts.
Diffstat (limited to 'debian/mauvealert-server.init')
-rw-r--r--debian/mauvealert-server.init15
1 files 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)