[systemd-devel] [PATCH] path: conditionally depend on the triggered unit

Lennart Poettering lennart at poettering.net
Tue Feb 3 07:38:58 PST 2015


On Mon, 29.12.14 14:07, Jouke Witteveen (j.witteveen at gmail.com) wrote:

heya,

sorry for the late review, still busy catching up with all the queued
mail.

> Path units having either PathExists=, PathExistsGlob=, or
> DirectoryNotEmpty= want the service they trigger when the condition is
> met. This way it becomes meaningful to include StopWhenUnneeded=true in
> the triggered service.

Hmm, I see how this could be useful, but the patch like this is not
OK. Dependencies in systemd are strictly additive. The only way to get
rid of dependencies is by doing a full reload of the configuration. We
coalesce dependencies from a variety of sources, and if we really
wanted to allow dynamically dropping deps again we'd couldn't do that
anymore and would have to track precisely the reason for each dep that
is added.

I wonder if we can find a better way to handle this...

So far the issue never came up since we expected that services would
exit-in-idle on their own, so that we never need an external trigger
to automatically shut something down, but the daemons would do so on
their own.

Can you elaborate on your precise usecase for this?

I mean, even if we added the facility you propose this would require
the services to operate in a certain way to be fully safe and
race-free. But if that's the case, then they might as well shut down
on their own at the right time?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list