Re: restart behavior (initscript)

Mark Hatle <[email protected]>
Newsgroups gmane.linux.lsb.discuss
Organization MontaVista Software, Inc.
Message-ID <[email protected]>
This is my interpretation of the spec.. so it very well may be wrong.

Ademar de Souza Reis Jr. wrote:
> Hello.
> 
> I have doubts about the behavior of the restart
> action in the following scenarios:
> 
> (i)
> The daemon (sshd in my case) is misconfigured, so
> after stopping it, it will not (re)start.
> 
>   Can I check for the presence of this scenario and refuse
>   to stop the service in the first place?

I'd consider this an undefined situation, however my feeling would be a 
stop followed by an aborted start.  The end result is the daemon has 
been stopped and an error message/status code sent to the user.

> (ii)
> When the daemon (sshd again) receives a SIGHUP, it spawns a
> new copy of itself and kills the old parent process, but the
> childs are kept alive.
> 
>   Since there's a new parent process (the one who accepts
>   new connections), can I consider this the same of a
>   restart?

This would be the "reload" case.  It is my interpretation that a restart 
must do exactly that.  Stop the current daemon, and fully restart it. 
The restart is useful if the physical binary changes, while a reload is 
useful if the configuration changes.

> So, should the spec of the restart action be interpreted
> as a "start" followed by a "stop" or can I implement this
> kind of behavior?

That is how I have interpreted it, and how MontaVista init scripts work.

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