[systemd-devel] Antw: [EXT] Re: Q: daemon-reload: when and how?

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu Jun 18 10:43:59 UTC 2020


>>> Jérémy ROSEN <jeremy.rosen at smile.fr> schrieb am 18.06.2020 um 11:01 in
Nachricht
<19710_1592470931_5EEB2D93_19710_59_1_CAFvCimXJwvDg0+5W11H0pUh+EHDTGxgbAuAGpG2PL
gjC0iX7A at mail.gmail.com>:
> Le jeu. 18 juin 2020 à 08:53, Ulrich Windl <
> Ulrich.Windl at rz.uni-regensburg.de> a écrit :
> 
>> Hi!
>>
>> I have a question: systemd monitors almost everything it seems to me. So I
>> wonder:
>> Under what conditions is it necessary to issue a daemon-reload, and why
>> can't systemd find out itself that a daemon-reload is required?
>>
> 
> There are some cases where systemd can detect the proper time for a
> daemon-reload, and does it implicitely
> systemd also check mtime of configuration files so it can see when a
> daemon-reload should be done.

Is there something like "systemd suggests daemon-reload" (assuming systemd
detects the situation, but does not issue a reload itself)?

> 
> However it is not because a file has been modified that systemd should
> decide to reload by itself.
> multiple unit files need to work together to make a working environment,
> and systemd can't know when all changes are consistent and
> it is safe to reload. So systemd will want an explicit order from the user.

I see (see above).

> 
> So if I think a "manual" daemon-reload is required, is it safe to do it
>> from within a unit?
>>
> 
> Usually, calling daemon-reload from a unit is a sign of bad design or
> misunderstanding of some tool. What exactly is the problem you are
> trying to solve ?
> 
> 
>> I have a "generator-like" type of unit that changes the configuration of
>> other units. However, as it seems, systemd ignores such changes until I
use
>> daemon-reload...
>>
> 
> Yes. you need an explicit daemon-reload here.
> why can't it be a real generator ?

AFAIK generators are quite low-level and have some restrictions. My unit is
kind of high-level (e.g. it needs all filesystems mounted). Actually I started
with a "normal" generator, but several restriction I can't remember right now
made me change my mind to convert the generator to a "normal" (more or less)
unit.

> 
> could you use systemd-run or the equivalent dbus API to do what you are
> trying to do ?

Good question! ;-) Browsing through the manpage I got the impression that it's
systemd's version of "batch" IMHO. I'm unsure whether this has any advantage
for my problem. For dbus I must admit that I have no experience of any kind
with it...

Regards,
Ulrich

[...]



More information about the systemd-devel mailing list