PROPOSAL: init file actions
A proposal for what arguments should be accepted by init files.
This is mostly from the Debian policy manual, and I added the
"status" option from Red Hat.
This is an attempt to specifically fulfill requirement #8 from
requirements draft #2 ("actions that init files must support").
Please let me know if you have any comments or concerns.
------- start of cut text --------------
Init files should accept one argument, saying what to do:
start the service,
stop the service,
stop and restart the service,
cause the configuration of the service to be reloaded without
actually stopping and restarting the service,
cause the configuration to be reloaded if the service supports
this, otherwise restart the service.
print the current status of the service
The start, stop, restart, force-reload, and status options must be
supported by all init files, the reload option is optional.
Init files should ensure that they will behave sensibly if invoked
with start when the service is already running, or with stop when it
isn't, and that they don't kill unfortunately-named user processes. The
best way to achieve this is usually to use start-stop-daemon .
If a service reloads its configuration automatically (as in the case
of cron, for example), the reload option of the init file should
behave as if the configuration has been reloaded successfully.
These executable files should not fail obscurely when the configuration
files remain but the package has been removed, as the default in [the
packaging system] is to leave configuration files on the system after
the package has been removed. Only when it is executed with the
[purge] option will [the packaging system] remove configuration files.
Therefore, you should include a test statement at the top of the file,
test -f program-executed-later-in-file || exit 0
or take the equivalent action if the init file is not a shell script.
------- end ----------------------------