Re: LSB initscripts: try-restart

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

On Thu, 31 Jul 2003, Tobias Burnus wrote:
> Thorsten Kukuk <[email protected]> wrote Tue, 29 Jul 2003:
> > what should be the return values for try-restart? This is one point
> > which leaves the current spec open.
> > I think if the service is running, try-restart should return the
> > same error codes as restart,
Right. But with exception of the "i.e." list this was already in the spec,
wasn't it?

> > but what is if the service is not running?
> Hmm, good question. RedHat's 'condrestart' usually does:
>   [some running test ] && restart || :
> and SuSE's try-restart currently (taken from /etc/init.d/skeleton):
>   $0 status >/dev/null &&  $0 restart

SuSE will now return a 0 (Success) in case no program is running. Since
returning a zero is in the spirit of the gLSB and since SuSE/UL and RedHat
(will) have the same return code, this patch adds

- running "try-restart" on a service already stopped or not running

to the situations that are also to be considered successful.

Please apply this patch and run 'make' in the sysinit directory.

Tobias
initactions.diff (text/plain, 1.2 KB)
Index: initactions.sgml
===================================================================
RCS file: /cvsroot/lsb/lsbspec/gLSB/sysinit/initactions.sgml,v
retrieving revision 1.7
diff -u -r1.7 initactions.sgml
--- initactions.sgml	23 Jul 2003 18:08:05 -0000	1.7
+++ initactions.sgml	8 Aug 2003 16:53:49 -0000
@@ -67,8 +67,8 @@
 
 <PARA>
 In the case of init script commands other than "status" (i.e.,
-"start", "stop", "restart", "reload", and "force-reload"), the init
-script must return an exit status of zero if the action described by
+"start", "stop", "restart", "try-restart", "reload", and "force-reload"),
+the init script must return an exit status of zero if the action described by
 the argument has been successful.  Otherwise, the exit status shall
 be non-zero, as defined below.  In addition to straightforward
 success, the following situations are also to be considered
@@ -86,6 +86,9 @@
 </PARA></LISTITEM>
 <LISTITEM><PARA>
 running "restart" on a service already stopped or not running
+</PARA></LISTITEM>
+<LISTITEM><PARA>
+running "try-restart" on a service already stopped or not running
 </PARA></LISTITEM>
 </ITEMIZEDLIST>
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.