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

Andrei Borzenkov arvidjaar at gmail.com
Fri Jul 8 19:07:28 UTC 2016


08.07.2016 22:01, Lennart Poettering пишет:
> On Fri, 01.07.16 06:37, Andrei Borzenkov (arvidjaar at gmail.com) wrote:
> 
>> In principle, I do not see why we cannot have WantedBy and RequiredBy as
>> first class directives under [Unit] to spare all these hoops.
> 
> systemd loads unit files as they are requested, by following
> dependencies. i.e. when we see Wants=foobar.service in a file
> quux.service, and quux.service is loaded because it shall be started
> then we'll load foobar.service too. systemd does not load unit files
> that are not referenced by any other unit. It hence minimizes what it
> loads, and it does *not* iterate through the unit dirs loading
> everything it finds there.
> 
> Now, if we would permit WantedBy= in [Unit], this would mean that if a
> unit file waldo.service carries WantedBy=miau.service in [Unit], then
> when miau.service is requested to be started we would somehow have to
> determine that waldo.service is to be loaded and started too. But how
> could we do that without loading all possible unit files as boot? i
> mean, how would we efficiently detect that waldo.service needs to be
> loaded when just looking at miau.service if the latter does not carry
> in anyway information about the former?
> 

I see, yes, I did not consider it. Thank you for explanation.


More information about the systemd-devel mailing list