[systemd-devel] Samba Config Reload

Lennart Poettering lennart at poettering.net
Mon Apr 11 07:58:54 UTC 2022


On Sa, 09.04.22 08:00, Yolo von BNANA (yolo at bnana.de) wrote:

> ------- Original Message -------
> On Friday, April 8th, 2022 at 13:49, Lennart Poettering <lennart at poettering.net> wrote:
>
> > This could be done better. Plugging in just a "kill" here, means the
> > reload is async. i.e. "systemctl reload" will basically return
> > immediately without the reload being complete, thus subsequent
> > commands can't rely the new config is already in place.
> >
>
> > It's typically nicer to invoke some synchronous command from
> > ExecReload=.
>
>
> Can you please explain this in more Detail?
>
> What does this mean: " "systemctl reload" will basically return
> immediately without the reload being complete"?

reload-via-SIGHUP means that the ExecReload= will just enqueue the
SIGHUP signal in the daemon and immdiately return. The daemon then
might take a while before it notices that the signal was queued, and
then take a while until it completed the reload.

Thus, if you have some script change a config file and then
immediately call "systemctl reload" on the relevant service, and
immediately expect the setting to be applied, then it might happen
that the daemon still hasn't noticed or completed the result.

Hence, typically it's better to plug in some tool into ExecReload=
that will not just enqueue a reload, but then wait until the daemon
reported back that the reload is now complete.

> And what is an Example for an synchronous command for ExecReload=

dbus-daemon for example uses:

    ExecReload=/usr/bin/busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig

Which is a synchronous call to reload the config: the daemon is told
to reload it, and "busctl call" then waits for the reply before
returning to systemd.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list