Re: Re: REVIEW: System Initialization

Tobias Burnus <[email protected]>
Newsgroups gmane.linux.lsb.discuss
Message-ID <[email protected]>
Hi,

a) [PATCH]
This patch does
- Change "program is stopped" to "program is not running"
  for the "status" exit status codes in order to reduce possible
  confusion with "SIGSTOP"

- Change the exit status code for "killproc" for the case that the
  program is not running:
  "0"     if no signal is given (= TERM, wait, KILL; this is default use
          for "stop" and matches the exit code for "stop")
  "not 0" ("7"=program is not running) if a signal (such as HUP) is given



b) Other things that should (probably) be added, but I didn't:

- PID format: If multiple PIDs exists, they should be space separated
  in the PID file. (And this should be also the format used by
  pidofproc.)

- killproc should remove the PID file it the program is no longer running.
  (This happens with signal KILL, send by default if TERM didn't work.)
  A bit clean-up is not bad, especially if the program cannot do anything
  about.


Tobias


PS: For the moment I ignored these issues:

    *  start_proc: Creation of the PID file
       This is related the next item. In general one should assume that
       the program creates a PID itself.

    *  [ 677749 ] Forking of programs which don't detach themself
       Debian's start-stop-daemon uses "-b|--background" and SuSE's
       startproc/start_daemon does it automatically.
       If a program doesn't detach automatically, it probably neither
       creates nor deletes a PID file (see above).

    *  [ 677744 ] the behaviour of start_daemon is currently unclear
       Well, in a way this is also a problem for killproc and pidofproc.

       The problem is an (e.g. PERL) script which behaves nicely, but
       if start_daemon/killproc/pidofproc compares
       /proc/`cat $PIDFILE`/exe with $PATHNAME this fails, since
       that is a link to e.g. /usr/bin/perl. In this case one has to
       check whether /proc/<pid>/cmd starts with $PATHNAME.

    *  [ 568246 ] Init action: [force-]reload and stopped service
       force-reload might (re)start the service,
       or it only reloads the currently running service.
       That is: If foo is not running and I issue a "foo force-reload",
       foo might be running -- or not.

    *  [ 653167 ] Output from init scripts is described vaguely

    *  [ 740760 ] $named boot facility confusing



PPS: If WIP goes in, those SF LSB bugs can be marked as fixed:

 [ 540950 ] Init script Functions: Several details are unclear
 [ 677737 ] Exit status for killproc, start_daemon, pidofproc
 [ 677739 ] [Enhancement] pathname for killproc/pidofproc
 [ 677745 ] Should a pid file be deleted by killproc
 [ 677746 ] [Enhancement] start_daemon should have a PID file argument
 [ 677752 ] should-start
wip-sysinit.diff (text/plain, 1.8 KB)
Index: initactions.sgml
===================================================================
RCS file: /cvsroot/lsb/spec/wip/sysinit/initactions.sgml,v
retrieving revision 1.2
diff -u -r1.2 initactions.sgml
--- initactions.sgml	29 Apr 2003 12:49:44 -0000	1.2
+++ initactions.sgml	17 Jun 2003 16:21:44 -0000
@@ -55,7 +55,7 @@
 <MEMBER>0</MEMBER><MEMBER>program is running or service is OK</MEMBER>
 <MEMBER>1</MEMBER><MEMBER>program is dead and /var/run pid file exists</MEMBER>
 <MEMBER>2</MEMBER><MEMBER>program is dead and /var/lock lock file exists</MEMBER>
-<MEMBER>3</MEMBER><MEMBER>program is stopped</MEMBER>
+<MEMBER>3</MEMBER><MEMBER>program is not running</MEMBER>
 <MEMBER>4</MEMBER><MEMBER>program or service status is unknown</MEMBER>
 <MEMBER>5-99</MEMBER><MEMBER>reserved for future LSB use</MEMBER>
 <MEMBER>100-149</MEMBER><MEMBER>reserved for distribution use</MEMBER>
Index: initfunctions.sgml
===================================================================
RCS file: /cvsroot/lsb/spec/wip/sysinit/initfunctions.sgml,v
retrieving revision 1.2
diff -u -r1.2 initfunctions.sgml
--- initfunctions.sgml	30 Apr 2003 19:10:57 -0000	1.2
+++ initfunctions.sgml	17 Jun 2003 16:21:44 -0000
@@ -42,9 +42,10 @@
 after some number of seconds is sent.
 Compliant applications may use the basename instead of the 
 pathname.
-killproc should return the LSB defined exit status codes. It
-shall return 0 if the program has been stopped or is not running
-and not 0 otherwise. 
+killproc should return the LSB defined exit status codes. If called
+without a signal, it shall return 0 if the program has been stopped or
+is not running and not 0 otherwise. If a signal is given, it shall return 0
+only if the program is running. 
 </MEMBER>
 
 <MEMBER>pidofproc [-p pidfile] pathname</MEMBER>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.