[systemd-devel] Upstream service file for NTP daemon chrony

Kay Sievers kay at vrfy.org
Mon Jul 2 15:55:03 PDT 2012


On Tue, Jul 3, 2012 at 12:44 AM, Paul Menzel
<paulepanter at users.sourceforge.net> wrote:
>> I'm also generally skeptical of After= without a corresponding
>> Requires= entry because it only affects the ordering if the other unit
>> is already present in the working set of services then being started.
>
> I did not get that. The manuals are waiting for me.
>
>> If something's required to happen before a unit, you need both.
>
> Understood.

$ man systemd.unit

"Before=, After=
Configures ordering dependencies between units. If a unit foo.service
contains a setting Before=bar.service and both units are being
started, bar.service's start-up is delayed until foo.service is
started up. Note that this setting is independent of and orthogonal to
the requirement dependencies as configured by Requires=. It is a
common pattern to include a unit name in both the After= and Requires=
option in which case the unit listed will be started before the unit
that is configured with these options."

Means:
Before=, After= will only take effect if you start a set of things in
one step (n items are a set, and that set is in one and the same
transaction).

If you start A and B together, it will be that defined order, but if
you first start A then B, or first B then A, it will just start in the
order the start calls are issued: A,B or B,A.

Only if requirements are specified, they will pull-in the needed
things and make sure runtime dependencies are fulfilled, if they need
to be.

Kay


More information about the systemd-devel mailing list