[systemd-devel] Difference between After and RequiredBy

Colin Guthrie gmane at colin.guthr.ie
Tue Nov 29 09:45:02 PST 2011


'Twas brillig, and Edward Z. Yang at 29/11/11 16:41 did gyre and gimble:
> Excerpts from Colin Guthrie's message of Tue Nov 29 11:32:01 -0500 2011:
>> I think RequiredBy is just the same semantically as Requires (it just
>> allows the requirement to be specified in a remote unit), in which case
>> this section from the manual page (man 5 systemd.unit) should explain
>> things. Ultimately Wants/Requires do not implicitly guide the ordering
>> of service start, but Before/After do. With Requires/Wants both services
>> might be started at the same time and thus one service needs the other
>> to be up and running while it starts up, you will need to add the
>> After/Before keys somewhere. It's worth reading the rest of the man
>> page, especially the section on Before= and After=.
> 
> OK, so in this particular case, under some circumstances 'httpd'
> would "require" 'remote-fs' (namely, if your document root is on
> the remote filesystem) and would not require it otherwise.
> 
> In this case of 'sometimes' requirement, should 'Requires' be specified?

I think that it should just say "After=" and not "Requires="

That way, if the user enables both the httpd.service and the
remote-fs.service units, you can be confident that httpd.service will
only be started after remote-fs.service.

But if remote-fs.service is not enabled (because the sysadmin has
decided there are no remote filesystems to mount) then httpd should be
able to start quite happily without that unit.

I've not looked at the bug tho', so take the above with a small pinch of
salt!

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list