[systemd-devel] Antw: [EXT] Re: [systemd‑devel] Examples to distinguish Before=/After= and Wants=/Requires=/BindsTo=

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Fri Oct 1 10:33:30 UTC 2021


>>> Lennart Poettering <lennart at poettering.net> schrieb am 17.09.2021 um 11:49
in
Nachricht <YURkx+fwv2FzkFIc at gardel-login>:
> On Mi, 15.09.21 17:15, Manuel Wagesreither (ManWag at FastMail.FM) wrote:
> 
>> Hello all,
>>
>> I'm onboarding some collegues who don't have much experience with
>> systemd. One thing I would like to focus on is the difference
>> between Before=/After= and Wants=/Requires=/BindsTo in systemd
>> units.
>>
>> I think it would get immediately clear if could provide them an
>> example where we want one but not the other. Unfortunately I've got
>> problems coming up with such an example. In my use cases, whenever I
>> needed an After= I needed an Wants= as well.
>>
>> Can you come up with something good?
> 
> Whenever you have a conceptually "weak" dependency between to
> packages, i.e. both services can work alone, but they can also wor
> together, and if so, one should be ordered after the other.
> 
> more specific example: you can use apache without mysql, and you can
> use mysql without apache, but quite often they are used together, and
> if so you likely want to start mysql first, and apache second, since
> it likely consumes services of mysql, and not the other way
> round. Hence in this example, you'd place an ordering dep, but not
> requirement dep.

And another aspect: While you could add the dependencies in mysql as well as
apache, you'd probably do it in apache here (as it is the "consumer"), right?
Or would you place it outside of both?

> 
> Lennart
> 
> ‑‑
> Lennart Poettering, Berlin





More information about the systemd-devel mailing list