[systemd-devel] How to properly write an "umbrella" unit

Lennart Poettering lennart at poettering.net
Wed Jul 22 11:41:22 PDT 2015


On Wed, 22.07.15 20:28, Michael Biebl (mbiebl at gmail.com) wrote:

> 2015-07-22 19:15 GMT+02:00 Lennart Poettering <lennart at poettering.net>:
> > On Tue, 21.07.15 13:43, Marc Haber (mh+systemd-devel at zugschlus.de) wrote:
> >> Can I write my nifty.target as a service? I have seen in this case
> >> nifty.service files with Exec=/bin/true to basically create a no-op
> >> service, but that's ugly.
> >
> > That's a hack. A target is for grouping things, they basically are
> > services without processes attached to them. You really should use
> > targets for this, and not misuse services.
> 
> Afaik, there is no way to have a .target reloaded and that reload
> request propagated to all services in that target.
> 
> Say you have foo.target consisting of  bar.service and baz.service,
> how can you achieve that
> systemctl reload foo.target propagates that reload request to {bar,baz}.service?

You cannot do that right now, and I am not sure you should be able to,
after all the operation does not really apply to target units.

I do see your usecase though...

Humm...

Maybe we can change the manager core to propagate Reload() calls
for unit type that do not support it natively to other units listed in
PropagateReloadsTo= and then become a NOP.

Or in other words: invoking reload on a target that knows no
PropagateReloadsTo= should continue to return an error. But if such
deps are defined, it should become a silent NOP and propagate the
event.

Could you file an RFP issue on github asking for this? [or even better,
send a PR with a patch...  ;-) ]

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list