[systemd-devel] Requires and After

Tom H tomh0665 at gmail.com
Thu Jan 3 00:38:14 UTC 2019


On Wed, Jan 2, 2019 at 10:09 PM James Feeney <james at nurealm.net> wrote:
> On 1/2/19 3:21 AM, Reindl Harald wrote:
>>
>> it's pretty obvious when i REQUIRE something that it should be there
>> when i get started
>
> Not only is it not "obvious" that "something should be there", it is not true.
>
> You are confusing "Requires=" and "Requisite=".
>
> Some developers and some users are not native English speakers. In
> some cases, systemd terminology can be ... less than optimal, while,
> in other situations, users will simply misunderstand the conventional
> meaning of words.

You might not like how "Requisite=" is defined in systemd but that
doesn't mean that it's wrong or "less than optimal."

If a.service has "Requires=b.service" and b.service isn't started,
then b.service is started.

If a.service has "Requisite=b.service" and b.service isn't started
(and a.service fails).

What Reindl Harald was saying was that "Requires" should have an
implicit "After" because it wouldn't make sense for a.service to
require b.service but to start before b.service.

However, IIRC and IIUC, someone suggested a weird example where

- a.service can function without b.service being up and there's a
desire for b.service to start when a.service is started

- b.service cannot function without a.service being up

and where you'd therefore need "Wants=b.service" and
"Before=b.service" in a.service

You could even replace "Wants=" by "Requires=" if a.service can launch
without b.service being up but cannot function without b.service being
up.

Using "BindsTo=" ("PartOf=") in b.service rather than "Wants="
("Requires=") in a.service seems more intuitive to me from the
"Before"/"After" perspective.


More information about the systemd-devel mailing list