Re: restart behavior (initscript)
Jim Knoble <[email protected]>
| Newsgroups | gmane.linux.lsb.discuss |
|---|---|
| Message-ID | <[email protected]> |
Circa 2003-08-06 22:09:20 -0500 dixit Mark Hatle:
: This is my interpretation of the spec.. so it very well may be wrong.
:
: Ademar de Souza Reis Jr. wrote:
: > (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.
I don't see why a restart shouldn't be atomic, i.e., all-or-nothing,
especially for important system services like sshd.
: >(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.
For what it's worth, in the case of OpenSSH's sshd (www.openssh.com),
as well as a similar case for the Exim MTA (www.exim.org), sending
SIGHUP causes the daemon to re-exec itself at the path it was started
from. That is, in pseudocode:
variable saved_arguments
main(argc, argv) {
saved_arguments = argv
do_stuff
}
on_receiving_sighup() {
execv(saved_arguments[0], saved_arguments)
}
This does in fact fully restart the binary, it merely avoids closing
down child processes (which, in the case of sshd, could be a really bad
thing if you're managing the system from an SSH connection).
--
jim knoble | [email protected]
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)
signature.asc
(application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (OpenBSD) Comment: See http://www.pobox.com/~jmknoble/keys/ for my public key. iD8DBQE/MmpfKJ/qqBOBFJERAuM3AJ4/1O5PGD/W2UC0yMJKvcwFHKpR0QCgjKtA CI762HypITP7IMBAcyQXjjQ= =rHBy -----END PGP SIGNATURE-----