On Sun, Aug 31, 2003 at 13:11:38 +0200, Martin Godisch wrote: Attached an updated proposal, without exit code 5 clause. > Notes: > > * I suggest merging the "reserved for..." items, but left them > separated for the moment. > * What is log_failure_msg? Does this make sense on a Debian system? > Replace it or skip it? 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 10:52:12.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. + The <tt>start</tt>, <tt>stop</tt>, <tt>restart</tt>, + <tt>force-reload</tt>, and <tt>status</tt> options should + be supported by all scripts in <file>/etc/init.d</file>, + the <tt>reload</tt> option is optional. </p> <p> @@ -5421,6 +5424,69 @@ </p> <p> + In the case of init script commands other than <tt>status</tt> (i.e., + <tt>start</tt>, <tt>stop</tt>, <tt>restart</tt>, <tt>reload</tt>, and + <tt>force-reload</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 one of the following non-zero + exit status codes. + <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 the logging functions such as + <tt>log_failure_msg</tt>). + </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 +5714,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 +5750,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:
pgptJEL_eA1tG.pgp
Description: PGP signature