2014-10-31 17:01 GMT-06:00 Tom H <[email protected]>:
> On Fri, Oct 31, 2014 at 2:27 PM, Rich Freeman <[email protected]> wrote:
>> On Fri, Oct 31, 2014 at 1:34 PM, Tom H <[email protected]> wrote:
>
>
>>> Is "After" really necessary as an option? I've never come across a
>>> service that uses "After" without a "Requires" or a Wants" but I've
>>> never taken the time to look.
>>
>> Hmm, I found After more common that Wants, but maybe I only look at
>> units that have problems. :)
>
> LOL. Which supports the thesis that "After" might not be a useful
> setting within a service unit. But it's just occured to me that target
> units use "After" without "Requires" or "Wants", for example
> network-online.target has "After=network.target".
>
I think the manuals are pretty clear about the working of these.
>From the systemd.unit manual:
"""
....
Requires=
.... If a unit foo.service requires a unit bar.service as configured
with Requires= and no ordering is configured with After= or Before=,
then both units will be started simultaneously and without any delay
between them if foo.service is activated.
Before,After=
...
Note that this setting is independent of and orthogonal to the
requirement dependencies as configured by Requires=.
....
If two units have no ordering dependencies between them, they are
shut down or started up simultaneously, and no ordering takes place.
"""
>From sytemd.service manual
"""
Unless DefaultDependencies= is set to false, service units will
implicitly have dependencies of type Requires= and After= on
basic.target as well as dependencies of type Conflicts= and
Before= on shutdown.target. These ensure that normal service units
pull in
basic system initialization, and are terminated cleanly prior
to system shutdown.
"""
I think it's about flexibility and the fact that systemd uses
parallelization at boot, when having these options makes sense