Fwd: Re: daemon(8) exit behavior

From: Nathan Huff <nhuff_at_acm.org>
Date: Mon, 26 Dec 2022 21:13:29 UTC
Alan Somers <asomers@freebsd.org> writes:

> Do you mean SIGTERM instead of SIGHUP?

Yes I meant SIGTERM not SIGHUP.

> Instead of delaying for a fixed number of seconds, what if daemon were
> just to waitpid for the child after signaling it?  That would prevent
> a command like "service foo restart" from starting a new instance of
> the daemon.  But if the actual server process is still running, then
> that behavior is probably desirable.

That is basically what my modification does.  The delay really just
sends SIGKILL to the supervised process after the delay and waits for it
to die. The delay just gives the supervised process time to gracefully
shutdown before trying to more aggressively kill it.

> Waiting indefinitely is probably the best thing that we can do if a
> SIGKILLed process doesn't exit.

That is my opinion, but it isn't the current behavior so I figured
others might have a different opinion.

>> --
>> Nathan Huff