Re: How can you differentiate behavior between stop and stop as part of restart?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On Mon, Oct 14, 2024 at 05:54:28PM GMT, Kelsey Cummings <kelsey.cummings@xxxxxxxxx> wrote:
> I've come up to a problem that I haven't been able to figure out how to
> solve.  I have a well behaved daemon process that manages its own children
> and has both the ability to gracefully reload it's config and gracefully
> restart.  

Congrats!

> Restart as stop && start is close enough for my use case but in order to
> ensure the new parent process starts without waiting for the graceful stop
> to complete I had to set "KillMode=none" and explicitly add the "default"
> "ExecStop=/bin/kill -s QUIT $MAINPID" to the unit file.

It can't be repeated enough, so adding mine: please don't use
KillMode=none (it bypasses invariants systemd'd like to have and it's
not safe in general).

> I see some long past discussion about adding supporting for ExecRestart
> which could theoretically solve the problem but I figure I'm stuck thinking
> about it the wrong way.

Yeah, it dind't take off :-/

> What's the systemd canonical way to set get the desired behavior?

Possibly you could achieve similar behavior with ExecReload= (that could
even be considered canonical if you redefine what you mean by graceful
restart).

(If this was only about distinguishing plain vs restart stop operation,
you could configure different RestartKillSignal= and KillSignal=
however, old generation processes should still be cleaned up before
starting the new one.)

Michal

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux