On Mi, 06.04.22 06:21, Yolo von BNANA (y...@bnana.de) wrote:

> What is the best way to reload the Samba Configuration – and why?
>
> 1. systemctl reload smbd
> 2. smbcontrol smbd reload-config
> 3. pkill -HUP smbd
>
> I think it's this Order. (1 is best)
> But I couldn't explain it to somebody else.

I don't know what the "smbcontrol" thing precisely does.

So your option 3 is by far the worst. it will kill any process called
"smbd" with HUP, even if it has nothing to do with the system
service. Moreover, you only want to send SIGHUP to the main daemon
process usually, not any children it might have (that likely carry the
same name). Moreover, the operation is async: i.e. the reload request
is just enqueued and when pkill returns the reload might not even have
started yet, let alone completed. THus if you immediately follow with
another command, then the changes you made to smb.conf earlier (which
I presume is the reason why you want to reload) might or might not
have been applied.

The other two options are likely similar, i.e. synchronous and talk to
smbd directly. But I don't know samba that well, so it's just an
assumption. In fact, if ExecStop= in smbd.service just calls the
smbcontrol they behave very very similar.

If you do things through systemctl it has the benefit that systemd
knows about the reload, this is nice because this means systemd can
merge multiple reload requests, and you have better state tracking and
logs.

So yes, the order is correct, i'd say.

Lennart

--
Lennart Poettering, Berlin

Reply via email to