[systemd-devel] Help regarding service dependency

Andrey Borzenkov arvidjaar at gmail.com
Fri Mar 14 02:08:28 PDT 2014


On Fri, Mar 14, 2014 at 11:30 AM, Amit Saha <asaha at redhat.com> wrote:
>
>
> ----- Original Message -----
>> From: "Andrey Borzenkov" <arvidjaar at gmail.com>
>> To: "Amit Saha" <asaha at redhat.com>
>> Cc: "systemd Mailing List" <systemd-devel at lists.freedesktop.org>
>> Sent: Friday, March 14, 2014 12:35:44 PM
>> Subject: Re: [systemd-devel] Help regarding service dependency
>>
>> В Thu, 13 Mar 2014 21:25:34 -0400 (EDT)
>> Amit Saha <asaha at redhat.com> пишет:
>>
>> > Hello,
>> >
>> > We have service1 which starts in default.target, and we want it to start
>> > After service2
>> > (systemd-readahead-done) which starts after the default.target is reached.
>> > So, I think what would happen in this case is the After=service2 for
>> > service1 is ignored
>> > and it is started before service2 since the default.target must be reached.
>> >
>>
>> There is no ordering dependencies between default.target and individual
>> units; default.target is simply a way to define what is started using
>> Wants. So it should work.
>

My apologies; I tend to miss implicit dependencies. So yes, by default
if default.target Wants some unit it will be also ordered After this
unit.

> Thanks for your reply.
>
> I am not sure I follow you when you say "there is no ordering dependency between
> default.target and individual units". Let's say default.target.wants/
> have N services. What happens when you have a service, service2 whose
> unit file has After=default.target in it?  When does it start?
>

By default this creates a loop and systemd will need to break it; it
hopefully will ignore After=default.target.

But your unit definition in initial post had
DefaultDependencies=false. In this case I expect that no implicit
Before=default.target will be added. Did you test it?

> And, let's now introduce service1 which has:
>
> [Install]
> WantedBy=default.target
>
> How do the services, service1 and service2 start relative to each other and the services in
> default.target.wants?
>
> Thanks,
> Amit.


More information about the systemd-devel mailing list