[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#208010: [PROPOSAL] init script LSB 1.3 compliance (revised)



On Mon, Sep 01, 2003 at 11:54:32 +0200, Josip Rodin wrote:

> > +	    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.
> 
> This "status" needs to be made optional. We can't suddenly force
> implementation of such an option in dozens of packages just because it
> (is in LSB|sounds like a good idea).

o.k.

> > + Otherwise, the init script
> > +	    should print an error message and return one of the following non-zero
> > +	    exit status codes.
> 
> Rationale for the whole elaborate list,

Following closely the wording of the LSB, as the rest of that policy
chapter already does. The parenthesized part can be skipped without
problems.

> and in particular rationale why it
> would be a bug if they weren't honored exactly to the spec?

What do you consider not honoring the spec in that case? exit 1 is still
present and wouldn't be a bug.

> > * What is log_failure_msg? Does this make sense on a Debian system?
> >   Replace it or skip it?
> 
> The policy process does not work by randomly throwing stuff into patches,
> having them accepted, and then working out what the hell was it that we
> just added.

There was no intention to get this accepted before discussing it, that's
why I put that note before. I let it there for the same reason as above,
the current section 9.3 follows very closely the text of the LSB, which
I don't consider that bad. I let it there so it can be replaced with
some Debian equivalent, which I'm not aware of. Since you are neither,
it's probably a good idea to remove 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 12:47:54.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,66 @@
 	  </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 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 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 +5711,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 +5747,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: pgpwzRHzD5pl_.pgp
Description: PGP signature


Reply to: