[systemd-devel] Difference between After and RequiredBy

Lennart Poettering lennart at poettering.net
Thu Dec 15 07:55:32 PST 2011


On Tue, 29.11.11 11:19, Edward Z. Yang (ezyang at MIT.EDU) wrote:

> Hello folks,
> 
> On this ticket [1], we're attempting to figure out what
> the relationship between services like httpd.service and remote-fs.target
> are.  One particular point of contention is this: what is the
> difference between 'After' and 'RequiredBy'? Which is correct
> in this circumstance?

Ordering dependencies ("After=" and "Before=") are fully orthogonal to
requirement dependencies ("Requires=", "Wants=", ...) in systemd.

"RequiredBy=" is the implicit inverse of "Requires=". If you add
"Requires=" from A to B, then you'll implicitly get a "RequiredBy=" from
B to A.

What does it mean that ordering and requirement are orthogonal?
Basically, that you can pull in stuff independently of ordering it. You
can have a service A pull in B, and define no order at all (which would
mean parallel startup of A and B), or you can have A pull in B with A
starting after B (the most common), or you can have A pull in B with A
starting before B (also often used, for example to start the monitoring
service for MySQL automatically when MySQL is started, but start it
after MySQL is up).

Does this explanation make sense?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list