Systemd Unit File - WantedBy and After
The systemd
manual discusses the relationship between Before
/After
and Requires
/Wants
/Bindto
in the Before=, After=
section:
Note that this setting is independent of and orthogonal to the requirement dependencies as configured by Requires=, Wants= or BindsTo=. It is a common pattern to include a unit name in both the After= and Requires= options,
After
does not imply Wants
or WantedBy
, nor does it conflict with those settings.
If both units are triggered to start, After
will affect the order, regardless of the dependency chain.
If the module listed in After
is not somewhere in the dependency chain, it won't be loaded, since After
does not imply any dependency.
WantedBy
does not influence the order in which services are started.
As stated in systemd unit manual, in the WantedBy
and RequiredBy
description:
This has the effect that a dependency of type Wants= or Requires= is added from the listed unit to the current unit.
Then in the Wants
description it states that it is a weaker version of Requires
where it states:
Note that requirement dependencies do not influence the order in which services are started or stopped.