[systemd-devel] unable to attach pid to service delegated directory in unified mode after restart

Felip Moll felip at schedmd.com
Wed Mar 23 23:45:22 UTC 2022


Hi, some days ago we were talking about this:


> > Problem number two, there's a significant delay since when creating the
> > scope, until it is ready and the pid attached into it. The only way it
> > worked was to put a 'sleep' after the dbus call and make my process wait
> > for the async call to dbus to be materialized. This is really
> > un-elegant.
>
> If you want to synchronize in the cgroup creation to complete just
> wait for the JobRemoved bus signal for the job returned by
> StartTransientUnit().
>
>
StartTransientUnit returns a string to a job object path. To call
JobRemoved I need the job id, so the easier way to get it is to strip the
last part of the returned string from StartTransientUnit job object path.
Am I right?

Once I have the job id, I can then subscribe to JobRemoved bus signal for
the recently created job, but what happens if during the time I am
obtaining the ID or parsing the output, the job is finished? Will I lose
the signal?

What is the correct order of doing a StartTransientUnit and wait for the
job to be finished (done, failed, whatever) ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220324/703ae82e/attachment.htm>


More information about the systemd-devel mailing list