Your message dated Thu, 3 Aug 2017 15:48:59 -0400 with message-id <20170803194858.mbl7kjh3shsyzgie@iris.silentflame.com> and subject line Re: Bug#291148: 'status' option should be required of init.d scripts has caused the Debian Bug report #291148, regarding status action for init.d scripts to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org immediately.) -- 291148: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291148 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: [PROPOSAL] Add a 'status' option in init.d scripts
- From: Javier Fernández-Sanguino Peña <jfs@computer.org>
- Date: Wed, 19 Jan 2005 01:30:55 +0100
- Message-id: <20050119003055.GA23770@silicio>
Package: debian-policy Version: 3.6.1.1 Priority: wishlist Tags: patch [ Note: I understand that this status suggestion is covered (without a valid example in #208010) but I believe that LSB compliance also forces some other things (like exit codes) which is still under discussion. That's why I'm opening this up as a different bug report and not following up there. If this is fixed through applying the patch at #208010 please consider the example change introduced in the patch attached (which actually has a 'status' function that works although there is obviously room for improvement) ] I would like a new option to be added to init.d scripts: 'status' which basicly tells what status is the service currently in (either running or dead). This option is quite handy when you want to determine the system status (instead of blindly trying 'restart' and see what happens). It is also useful also to determine if the start-stop-daemon call succeeded and left a running program. Currently most init.d scripts will happily start up services which are not correctly configured and admins will not notice that they didn't start up until they check the service itself (is it running? what do the logs say?). I would appreciate more consistent behaviour here, one thing I like of other distributions is that you actually get to see if the system starts up succesfully just by looking at the boot sequence. In Debian, many init.d scripts just don't check wether they left a running service. This 'status' option proposal is a first step towards enforcing init.d scripts to do so. I've attached a patch with the proposal including both the description and a change to the sample init.d script implementing it. Please consider this for Debian's policy. Regards Javier--- policy.sgml.orig 2005-01-19 01:10:37.000000000 +0100 +++ policy.sgml 2005-01-19 01:13:05.000000000 +0100 @@ -5382,7 +5382,7 @@ <tag><tt>restart</tt></tag> <item>stop and restart the service if it's already running, - otherwise start the service</item> + otherwise start the service,</item> <tag><tt>reload</tt></tag> <item><p>cause the configuration of the service to be @@ -5392,13 +5392,17 @@ <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><p>show the status of the service (either running + or dead).</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 status option are optional. </p> <p> @@ -5678,19 +5682,42 @@ . /etc/default/bind fi +# Function used to determine if the program is alive +is_alive () { + ret=1 + if [ -r "/var/run/named.pid" ] ; then + pid=`cat /var/run/named.pid` + if [ -e /proc/$pid ] ; then + procname=`/bin/ps h -p $pid -C bind` + [ -n "$procname" ] && ret=0 + fi + fi + return $ret +} +# Print output based on status +print_status() { + if is_alive; then + echo "." + else + echo "failed." + exit 1 + fi +} + + case "$1" in start) echo -n "Starting domain name service: named" start-stop-daemon --start --quiet --exec /usr/sbin/named \ -- $PARAMS - echo "." + print_status ;; stop) echo -n "Stopping domain name service: named" start-stop-daemon --stop --quiet \ --pidfile /var/run/named.pid --exec /usr/sbin/named - echo "." + print_status ;; restart) echo -n "Restarting domain name service: named" @@ -5698,13 +5725,22 @@ --pidfile /var/run/named.pid --exec /usr/sbin/named start-stop-daemon --start --verbose --exec /usr/sbin/named \ -- $PARAMS - echo "." + print_status ;; force-reload|reload) echo -n "Reloading configuration of domain name service: named" start-stop-daemon --stop --signal 1 --quiet \ --pidfile /var/run/named.pid --exec /usr/sbin/named - echo "." + print_status + ;; +status) + echo -n "Status of domain name service: " + if is_alive ; then + echo "alive." + else + echo "dead." + exit 1 + fi ;; *) echo "Usage: /etc/init.d/bind " \Attachment: signature.asc
Description: Digital signature
--- End Message ---
--- Begin Message ---
- To: 291148-done@bugs.debian.org
- Cc: control@bugs.debian.org
- Subject: Re: Bug#291148: 'status' option should be required of init.d scripts
- From: Sean Whitton <spwhitton@spwhitton.name>
- Date: Thu, 3 Aug 2017 15:48:59 -0400
- Message-id: <20170803194858.mbl7kjh3shsyzgie@iris.silentflame.com>
- Mail-followup-to: Sean Whitton <spwhitton@spwhitton.name>, 291148-done@bugs.debian.org, control@bugs.debian.org
- In-reply-to: <20050531153801.D4C023CC00E@tigger.sf.gildea.net>
- References: <20050531153801.D4C023CC00E@tigger.sf.gildea.net>
user debian-policy@packages.debian.org usertag -1 = normative dubious tag -1 +wontfix thanks On Tue, May 31, 2005 at 08:38:01AM -0700, Stephen Gildea wrote: > The "status" option should be required, not optional. Only if it can be > counted on will it be useful. init scripts now follow LSB, which mandates the status option. -- Sean WhittonAttachment: signature.asc
Description: PGP signature
--- End Message ---