[systemd-devel] Why do stop jobs run asynchronously on "systemctl isolate target"?

Umut Tezduyar umut at tezduyar.com
Mon Mar 25 01:54:09 PDT 2013


Hi,

Lets talk on an example. Say we have a target, A.target,  that has 100
services starting up and B.target which has only 1 service to start out of
100 services that have been started by A.target. When switching from
A.target to B.target, "systemctl isolate B.target" will return immediately,
"systemctl is-active B.target" will tell is-active immediately. But, I
think switching hasn't been completed since 99 services that are started by
A.target are being stopped in the background. My thought is, B.target is
NOT active until all the services are started and all the services are
stopped.

Do we need to add After=, Before= to all 99 services against B.target? Is
there a better way? Ex: "systemctl isolate B.target --wait-for-stop-jobs"

I am using "systemctl list-jobs" to ensure that all the stop jobs are also
completed.

Thanks


On Sat, Mar 23, 2013 at 3:43 AM, Lennart Poettering
<lennart at poettering.net>wrote:

> On Fri, 08.03.13 14:38, Umut Tezduyar (umut at tezduyar.com) wrote:
>
> > Hi,
> >
> > I have realized that return of "systemctl isolate <target>" command is
> only
> > synchronous for "starting" jobs but not for "stopping" jobs. How can
> > one
>
> Well, it is synchronous to jobs that are ordered against the unit you
> isolate, this isn't any different from any other unit ordering...
>
> You might simply need to add an After= or Before= dependency?
>
> Not that when a unit is started and another one is stopped and they are
> ordered against each other, the one to be stopped is first stopped,
> before the one to be started is started, regardless whether After= or
> Before= was used. Or in other words: the difference between After= and
> Before= only has an effect on the order of two jobs that are started,
> or two jobs that are stopped, but not on two jobs where one is started
> and the other is stopped.
>
> Lennart
>
> --
> Lennart Poettering - Red Hat, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130325/4a2bc980/attachment.html>


More information about the systemd-devel mailing list