Whiteboard Web |
Linux »
DaemonsDaemons are normally started by the start-stop-daemon wrapper program. A few notes about this are in place. Often you do not consider "/etc/init.d/my_daemon start" a failure if "my_daemon" is already running. Also the opposite, stopping a non-running daemon is also often considered ok. If not, irritating things occurs, like you are not able to uninstall a faulty package, because the stop command failed to stop the non running daemon ... To avoid this, start/stop your daemons with the "--oknodo" switch to the start-stop-daemon command. The LSB template script starting & stopping daemons begin with (as all well written scripts) "set -e" to make the shell terminate the script upon the return of an error code by any used command/program. Unfortunately this will make the script terminate abnormally if the daemons exits with a non-zero value. Either you have your daemon return zero value for all exit conditions and never return EXIT_FAILURE relying on other mechanisms to check running status, or you have to explicit take care of the return value yourself. http://www.davidpashley.com/articles/writing-robust-shell-scripts.html |
|
Page last modified 2009-05-06 13:03Z |