1 |
2014-10-31 17:01 GMT-06:00 Tom H <tomh0665@×××××.com>: |
2 |
> On Fri, Oct 31, 2014 at 2:27 PM, Rich Freeman <rich0@g.o> wrote: |
3 |
>> On Fri, Oct 31, 2014 at 1:34 PM, Tom H <tomh0665@×××××.com> wrote: |
4 |
> |
5 |
> |
6 |
>>> Is "After" really necessary as an option? I've never come across a |
7 |
>>> service that uses "After" without a "Requires" or a Wants" but I've |
8 |
>>> never taken the time to look. |
9 |
>> |
10 |
>> Hmm, I found After more common that Wants, but maybe I only look at |
11 |
>> units that have problems. :) |
12 |
> |
13 |
> LOL. Which supports the thesis that "After" might not be a useful |
14 |
> setting within a service unit. But it's just occured to me that target |
15 |
> units use "After" without "Requires" or "Wants", for example |
16 |
> network-online.target has "After=network.target". |
17 |
> |
18 |
I think the manuals are pretty clear about the working of these. |
19 |
From the systemd.unit manual: |
20 |
""" |
21 |
.... |
22 |
Requires= |
23 |
.... If a unit foo.service requires a unit bar.service as configured |
24 |
with Requires= and no ordering is configured with After= or Before=, |
25 |
then both units will be started simultaneously and without any delay |
26 |
between them if foo.service is activated. |
27 |
|
28 |
Before,After= |
29 |
... |
30 |
Note that this setting is independent of and orthogonal to the |
31 |
requirement dependencies as configured by Requires=. |
32 |
.... |
33 |
If two units have no ordering dependencies between them, they are |
34 |
shut down or started up simultaneously, and no ordering takes place. |
35 |
|
36 |
|
37 |
""" |
38 |
|
39 |
|
40 |
|
41 |
From sytemd.service manual |
42 |
""" |
43 |
Unless DefaultDependencies= is set to false, service units will |
44 |
implicitly have dependencies of type Requires= and After= on |
45 |
basic.target as well as dependencies of type Conflicts= and |
46 |
Before= on shutdown.target. These ensure that normal service units |
47 |
pull in |
48 |
basic system initialization, and are terminated cleanly prior |
49 |
to system shutdown. |
50 |
|
51 |
""" |
52 |
I think it's about flexibility and the fact that systemd uses |
53 |
parallelization at boot, when having these options makes sense |