[systemd-devel] Depending on services from a service unit template

Lennart Poettering mzerqung at 0pointer.de
Fri Jul 8 19:05:47 UTC 2016


On Mon, 27.06.16 08:25, Paul Menzel (paulepanter at users.sourceforge.net) wrote:

> Dear systemd folks,
> 
> 
> having a template for a service unit like `example at .service`, and
> starting several services from it, is there a way, to let another
> service unit require all services started from that template?

Well, what does "all instances" even mean? Note that instances can be
instantiated dynamically. i.e. without having a unit file
foo at bar.service on disk you can simply by having foo at .service on disk
make "systemctl start foo at bar.service" work. Hence, if you want some
other service to have deps onto "all" instances of foo at .service, then
this would mean you'd have to add deps for really all theoretically
possible instance strings, and those are quite a few...

Now, what would make more sense if by "all" you just mean "all *enabled*
instances". if that's what you mean then RequiredBy= in [Install]
should do what you need.

Alternatively, if by "all" you mean "all *running" instances", then
you could use PartOf= in the instance unit file instead of
Requires=. The effective difference is that only stops are propagated,
but not starts.

Hope this makes some sense,

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list