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

2020-06-18 Thread Simon McVittie
On Thu, 18 Jun 2020 at 11:01:59 +0200, Jérémy ROSEN wrote:
> 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.

Also, reloading is disruptive and can be "expensive" in terms of resource
use. If you're making a lot of changes (like an upgrade transaction in
a package manager like apt or RPM), you probably want to do the entire
transaction, and then reload *once*.

dbus-daemon *does* automatically reload when configuration or service files
change. People now expect/rely on this, so it's undesirable to change,
but with hindsight I wish it didn't. I think the fact that systemd *doesn't*
automatically reload is partly learning from dbus-daemon's mistake.

On Thu, 18 Jun 2020 at 12:43:59 +0200, Ulrich Windl wrote:
> Is there something like "systemd suggests daemon-reload" (assuming systemd
> detects the situation, but does not issue a reload itself)?

Yes there is:

$ systemctl status dbus.service
(... some information here ...)
$ sudo touch /lib/systemd/system/dbus.service
$ systemctl status dbus.service
Warning: The unit file, source configuration file or drop-ins of
dbus.service changed on disk. Run 'systemctl daemon-reload' to reload
units.
(... same status information ...)

In this case I didn't really alter /lib/systemd/system/dbus.service,
just changed its mtime, but you'd get the same thing from an edit that
actually matters.

smcv
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-06-18 Thread Jérémy ROSEN
Le jeu. 18 juin 2020 à 08:53, Ulrich Windl <
ulrich.wi...@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.

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.

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 ?

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


>
> (systemd-228-157.9.1.x86_64 of SLES12)
>

Ouch that's old...
Hopefully there are not too many missing features I'm used to have in
there...

Regards
Jeremy

>
> Regards,
> Ulrich
>
>
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


-- 
[image: SMILE]  

20 rue des Jardins
92600 Asnières-sur-Seine
*Jérémy ROSEN*
Architecte technique

[image: email] jeremy.ro...@smile.fr
[image: phone]  +33 6 88 25 87 42
[image: url] http://www.smile.eu

[image: Twitter]  [image: Facebook]
 [image: LinkedIn]
 [image: Github]


[image: Découvrez l’univers Smile, rendez-vous sur smile.eu]

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-06-18 Thread Ulrich Windl
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?
So if I think a "manual" daemon-reload is required, is it safe to do it from 
within a unit?
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...

(systemd-228-157.9.1.x86_64 of SLES12)

Regards,
Ulrich



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel