[lsb-discuss] LSB initscripts: try-restart

Tobias Burnus tobias.burnus at physik.fu-berlin.de
Thu Jul 31 05:44:36 PDT 2003


Thorsten Kukuk <kukuk at suse.de> 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, this is then the normal exit (error) status code + "0" if the
program could successfully be restarted.

> 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

That is:
- If running the restart exit status code is given
- If not running, SuSE returns a 1 while RedHat returns a 0

Returning a success (= 0) is in so far the right thing since that is
exactly want is requested: don't restart if not running.

On the other hand: It is nice to know whether something has
happend or not and therefore returning a "7" makes sense too.

I do not want to decide this. At least not without further comments.


More information about the lsb-discuss mailing list