Comment 4 for bug 1033856

Revision history for this message
Gavin Chappell (g-a-c) wrote :

As well as the retry lacking an interval, there's also incorrect ordering of the arguments in the restart section:

start-stop-daemon --start --quiet --pidfile --retry /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true

should read

start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --retry 5 --exec $DAEMON -- $DAEMON_OPTS || true

One thing you may want to consider is simply writing the start/stop logic as a function outside of the case statement, and then just using "stop" or "start" as necessary. This way, each piece of code is only stored once, and makes it harder for a typo to introduce inconsistency as it does here (a restart should pretty much always do the same thing as a stop/start but doesn't in this case due to the commands not matching up). I've attached an example which (in theory) is easier to maintain due to only having one function for start and stop so each piece of code only needs to be maintained once.