[systemd-devel] Special targets - should they Want or be WantedBy?

Lennart Poettering lennart at poettering.net
Thu Mar 17 15:32:31 PDT 2011


On Thu, 17.03.11 14:32, Andrey Borzenkov (arvidjaar at mail.ru) wrote:

> > Ah, I missed the "target units" part, but even then
> > "Requires=network.target + After=network.target" is a common
> > enough pattern for services that need network to be up at startup and
> > After= line is present in each one of them:
> >
> 
> Dependencies are added to target for units that it pulls. Not other way round.
> 
> >  /lib/systemd/system/noip.service:Requires=network.target
> >  /lib/systemd/system/dnscache.service:Requires=network.target
> >  /lib/systemd/system/tinydns.service:Requires=network.target
> >  /lib/systemd/system/remote-fs.target:Requires=network.target
> >  /lib/systemd/system/ziproxy.service:Requires=network.target
> >  /lib/systemd/system/ejabberd.service:Requires=network.target
> >  /lib/systemd/system/dhcpd.service:Requires=network.target
> 
> I tentatively think that these should be either After or Requisite. Do
> you really want to start network every time one of those services gets
> started (assuming there were reasons to have network stopped at this
> moment)?

Yes, I agree fully with Andrey. For two reasons:

A) I think it is important to implement lose coupling, i.e. ejabber
works fine without network, hence a Requires= is not really necessary.

and

B) Whether a service is enabled or not should be a decision of the admin
he can control with "systemctl enable" and "systemctl". When you use
Wants/Requires too often you bit by bit take this away from the admin,
since simply enabling ejabber might also enable the network in your
case, which is not necessarily what the admin wants.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list