Re: LSB initscripts: try-restart

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

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, 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.

Tobias
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.