[systemd-devel] GuessMainPID=no required to make daemon reload work

Gerd v. Egidy lists at egidy.de
Mon May 5 14:17:15 PDT 2014


Hi Lennart,

thanks for your tips.

> > EnvironmentFile=/etc/sysconfig/icinga2
> 
> This is a Fedoraism/Redhatism, I can only recommend not adding something
> like this to upstream projects.

You are right. Will think of an alternative way that works everywhere.

> > ExecReload=/bin/sh -c '/bin/kill -HUP `cat
> > ${ICINGA2_STATE_DIR}/run/icinga2/icinga2.pid`'
> 
> This is suboptimal. First of all, you should just tell systemd what the
> PID file is, with $PIDFile, and then you can use $MAINPID to refer to
> the PID.

I tried that first. But then the problem with switching from one daemon to the 
other hit me (see my first mail and my mails to Kirill for details), so I 
started to look for alternatives and got it working by keeping the pidfile 
hidden from systemd and using GuessMainPID=no. But I'm not happy with this 
solution, so I wrote to this mailinglist...

> Secondly, the killing is asynchronous.

When looking at 
http://www.freedesktop.org/software/systemd/man/systemd.service.html
I see "/bin/kill -HUP $MAINPID" recommended. How is this different in regards 
to asynchronism than the command I used above? In both cases systemd doesn't 
know when the reload is finished and if it was successful or not.

> It's a much better idea
> to have some scheme in place that makes sure the process invoked by
> ExecReload= does not return before the reload is complete, so that this
> is race-free and can be used to order things against each other...

This would mean I'd need a more complex scheme with something like a control 
socked and feedback through this socket. Maybe we add this at a later stage.

Kind regards,

Gerd



More information about the systemd-devel mailing list