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

Bug#291148: marked as done (status action for init.d scripts)



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 ---
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 ---
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 Whitton

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply to: