Re: daemon(8) exit behavior

From: Souji Thenria <>
Date: Mon, 26 Dec 2022 18:28:20 UTC
On 12/26/22 18:18, Nathan Huff wrote:
> 1. Is there any interest in upstreaming this?

Because I run in to this problem as well in the past, I would be most 
interested in this.

> 2. What should happen if the supervised process doesn't exit after the
> KILL signal is sent? Something has probably gone sideways somewhere if
> we end up here, but I have definitely seen cases where something is
> stuck with signals blocked.  Currently my modification waits for the
> process to actually exit possibly indefinitely. I chose that because I
> don't think we should clean up PID files if the process is in fact still
> running, but I can see wanting the daemon process to exit even if the
> supervised process is still running as that is the current behavior and
> still the behavior if a shutdown delay is not specified in my modified
> version.

I think using the timeout limit which is used by FreeBSD when shutting 
down the system, makes the most sens and would have some consistency 
throughout the system, at leas in my opinion.
Moreover, I think you should clean up the pidfile, if the daemon process 
created it. IIRC that's also the current behavior.

Souji Thenria