Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with systemd ExecReload and ExecStop? #138

Open
pukku opened this issue Jul 30, 2020 · 1 comment
Open

How to use with systemd ExecReload and ExecStop? #138

pukku opened this issue Jul 30, 2020 · 1 comment

Comments

@pukku
Copy link

pukku commented Jul 30, 2020

Hi! I'm trying to start up a service on CentOS 8, which means that I need to use a SystemD .service file. According to the documentation, if you try use something like kill -HUP $MAINPID to restart a service (or -QUIT to end it), it will not work properly because SystemD wants something synchronous, which kill is not.

Is there any proper solution to this? I can, of course, just leave these out, and SystemD will kill all the processes (possibly with prejudice) for me, but if there is a way to make this work nicely, I would be happier.

Thanks,
Ricky

@cwallacetlc
Copy link

I've been using kill -HUP $MAINPID to reload Starman in a SystemD service for several years, and haven't noticed any issues.

An alternative for sending QUIT, would be to set KillSignal=QUIT in the [Service] section. I haven't tried that, because I need to use ExecStop to do more than just send the signal, so my last ExecStop is this:

ExecStop=sh -c "/bin/kill -QUIT $MAINPID; while /bin/kill -0 $MAINPID 2>/dev/null; do sleep 1; done"

It seems to work just fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants