On Mon, Sep 01, 2003 at 16:56:27 +0100, Andrew Suffield wrote: > Otherwise, the init script should print an error message and return a > non-zero exit status code. Packages are encouraged to select return > codes based on the following list. Attached, thanks. Kind regards, Martin
--- debian-policy-3.6.1.0.orig/policy.sgml 2003-08-19 14:32:23.000000000 +0200 +++ debian-policy-3.6.1.0/policy.sgml 2003-09-01 18:28:06.000000000 +0200 @@ -5362,13 +5362,16 @@ <tag><tt>force-reload</tt></tag> <item>cause the configuration to be reloaded if the service supports this, otherwise restart the - service.</item> + service,</item> + + <tag><tt>status</tt></tag> + <item>print the current status of the service.</item> </taglist> The <tt>start</tt>, <tt>stop</tt>, <tt>restart</tt>, and <tt>force-reload</tt> options should be supported by all scripts in <file>/etc/init.d</file>, the <tt>reload</tt> - option is optional. + and <tt>status</tt> options are optional. </p> <p> @@ -5421,6 +5424,67 @@ </p> <p> + In the case of init script commands other than <tt>status</tt>, the + init script should return an exit status of zero if the action described + by the argument has been successful or the package is removed but not + purged. Otherwise, the init script should print an error message and + return a non-zero exit status code. Packages are encouraged to select + return codes based on the following list. + <taglist> + <tag>1</tag> + <item>generic or unspecified error,</item> + <tag>2</tag> + <item>invalid or excess argument(s),</item> + <tag>3</tag> + <item>unimplemented feature (for example, <tt>reload</tt>),</item> + <tag>4</tag> + <item>user had insufficient privilege,</item> + <tag>5</tag> + <item>reserved for LSB use,</item> + <tag>6</tag> + <item>program is not configured,</item> + <tag>7</tag> + <item>program is not running,</item> + <tag>8-99</tag> + <item>reserved for future LSB use,</item> + <tag>100-149</tag> + <item>reserved for distribution use,</item> + <tag>150-199</tag> + <item>reserved for application use,</item> + <tag>200-254</tag> + <item>reserved.</item> + </taglist> + All error messages should be printed on standard error. All status + messages should be printed on standard output. (This does not prevent + scripts from calling logging functions.) + </p> + + <p> + If the status command is given, the init script should return the + following exit status codes. + <taglist> + <tag>0</tag> + <item>program is running or service is OK,</item> + <tag>1</tag> + <item>program is dead and /var/run pid file exists,</item> + <tag>2</tag> + <item>program is dead and /var/lock lock file exists,</item> + <tag>3</tag> + <item>program is stopped,</item> + <tag>4</tag> + <item>program or service status is unknown,</item> + <tag>5-99</tag> + <item>reserved for future LSB use,</item> + <tag>100-149</tag> + <item>reserved for distribution use,</item> + <tag>150-199</tag> + <item>reserved for application use,</item> + <tag>200-254</tag> + <item>reserved.</item> + </taglist> + </p> + + <p> Often there are some variables in the <file>init.d</file> scripts whose values control the behaviour of the scripts, and which a system administrator is likely to want to @@ -5648,6 +5712,14 @@ . /etc/default/bind fi +help () { + echo "Usage: /etc/init.d/bind {start|stop|restart|reload|force-reload}" >&2 +} + +if [ "$2" ]; then + help + exit 2 +fi case "$1" in start) @@ -5676,10 +5748,13 @@ --pidfile /var/run/named.pid --exec /usr/sbin/named echo "." ;; +status) + help + exit 4 + ;; *) - echo "Usage: /etc/init.d/bind " \ - " {start|stop|restart|reload|force-reload}" >&2 - exit 1 + help + exit 2 ;; esac
Attachment:
pgpHR46kYL525.pgp
Description: PGP signature