Re: Services with multiple pre-requisites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrei Borzenkov wrote:
>> It has noticed and logged that one of the Requisite targets for the 
>> Third service isn't active, but it starts it anyway :-(
>> 
>> That seems to go directly against the documented behaviour (at 
>> https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Req
>> uisite
>> =):
>>   | Requisite=
>>   | 
>>   |     Similar to Requires=. However, if the units listed here are not
>>   |     started already, they will not be started and the starting of
>>   |     this unit will fail immediately.
>> 
>> Is this a bug, or am I still missing something?
>
> You miss ordering dependencies. Neither Requires not Requisite work without proper
> After/Before.
>
> systemd manuals make impression that dependencies are between units.
> This is wrong - dependencies are between jobs. If unit B has "Requisite:
> A" what happens is - systemd implicitly creates job for unit A that
> verifies current state of unit A and if it is not active fails pending
> start job for unit B. Without proper ordering both jobs (verify state of
> unit A and start unit B) run concurrently and the order is
> non-deterministic (or may be it is but then it is always "wrong" for
> your purpose :) ), so in your case job for Second runs too late, when
> Third is already started and there is no pending job to fail.

Ah. Thanks for the explanation. Adding
  Wants=first.target second.target
to my 'Third service' gave me exactly the behaviour I needed.

Respectfully suggest that the documentation bug should be fixed!

Martin

_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux