[systemd-devel] systemctl start second.service first.service
Uoti Urpala
uoti.urpala at pp1.inet.fi
Thu Jan 11 14:25:27 UTC 2018
On Thu, 2018-01-11 at 10:59 +0000, 林自均 wrote:
> I have 2 service unist: first.service and second.service. I
> configured "After=first.service" in second.service. Both services are
> "Type=oneshot".
>
> If I execute:
>
> # systemctl start first.service second.service
>
> The ordering dependency will work, i.e. second.service will start
> after first.service.
>
> However, if I execute:
>
> # systemctl start second.service first.service
>
> first.service and second.service will start at the same time.
>
> Is this behavior documented somewhere? Thanks!
I'd guess this is due to systemctl starting each listed unit
independently rather than as a single transaction. Thus, the second
version first starts second.service without first.service being active
at all. Since there's only an After relationship, not Wants/Requires,
second.service will immediately start. Then systemctl starts
first.service; since second.service is already running, there's nothing
the After relationship could affect.
More information about the systemd-devel
mailing list