So since no one had anything to add, here is a concrete proposal. All of this reflects current practice, I believe. Since the addition of status_of_proc to /lib/lsb/init-functions, this has been quite standardized in practice, and as I wrote earlier, more than half of the affected packages are already doing this.
* Add "status" as an optional init script option (similar to "reload"). No one objected to that. * Require exit status 0 or not 0. There were concerns about anything more specific, and it's not necessary in practice, as consumers of this generally only check for 0 or not 0. Could be refined in the future. * Add footnote encouraging use of LSB exit statuses anyway. * Add footnote about what "service is running" might mean. Some people in the discussion were concerned about this being ambiguous, some were concerned about making it too specific. The main nonhuman consumers of this interface are system monitoring programs that will decide to run "start" if "status" reports not running. So it is reasonable to define the behavior of "status" in terms of "start". * Add something simple about console messages from status option. That whole section seems to have been overtaken by reality, but what I wrote is pretty close to it. I think this matter could be moved from Discussion to Proposal now.
diff --git i/policy.sgml w/policy.sgml index 52dbb26..4dffbe0 100644 --- i/policy.sgml +++ w/policy.sgml @@ -6711,13 +6711,25 @@ rmdir /usr/local/share/emacs 2>/dev/null || true <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>report whether the service is running<footnote>A + service is running if the result of the + <tt>start</tt> action is in effect.</footnote>, exit + with status 0 if yes, with a status other than + 0<footnote>Packages are encouraged to use the + specific nonzero exit statuses defined by LSB, but + policy currently does not require their use. It is + only required to distinguish between 0 for running + and not 0 for not running.</footnote> if no.</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> @@ -7193,6 +7205,22 @@ Reloading <var>description</var> configuration...done. daemon starting message. </p> </item> + + <item> + <p>When the <tt>status</tt> action is called</p> + + <p> + When the <tt>status</tt> action is called and the + service is running, print: + <example compact="compact"> +<var>Service</var> is running. + </example> + When the service is not running, print: + <example compact="compact"> +<var>Service</var> is not running. + </example> + </p> + </item> </list> </p> </sect>