As part of their boot concept, some systems have individual start/stop scripts for each service (daemon). As a minimum, these scripts take either 'start' or 'stop' as argument, sometimes also e.g. 'reload' (to reload the configuration), 'restart', or 'status' (check whether the daemon is running). While this is convenient, there are also a number of problems:
Some systems do not have such start/stop scripts.
There is no standard for the location of these scripts.
There is no standard for the arguments such a script may take, neither for their interpretation (e.g.: on Linux distribution XYZ, do the start/stop scripts take 'status' as argument, and if, is the status reported by printing a message or by the exit status ?)
To provide a portable interface for controlling the samhain daemon, the executable itself can serve for this purpose ( only if invoked by the superuser) The supported actions, which must be given as first argument on the command line, are:
start Start samhain. Arguments after 'start' are passed to the process. Daemon mode will be enforced, as well as running in 'check' mode, irrespective of command line or config file settings.
stop Stop the daemon. On Linux and Solaris, actually all running instances of samhain are stopped, even if no pid file is available.
restart Stop and start.
reload or force-reload Reload the configuration file.
status Check whether the daemon is running.
Success/failure is reported via the exit status as follows: 0 Success. (On Linux/Solaris, stop will always be successful, on other systems only if the pid file is found.) 1 Unspecified error. 4 User had insufficient privilege. 5 Program is not installed. 7 Program is not running.
If the status command is given: 0 Program is running. 1 Program is dead and /var/run pid file exists. 3 Program is stopped. 4 Program status is unknown.
I.e., this interface behaves as mandated by the LSB Standard for init scripts.