Systemd service life cycle
Colin Law
clanlaw at gmail.com
Thu Apr 7 09:39:20 UTC 2016
On 7 April 2016 at 10:24, Colin Law <clanlaw at gmail.com> wrote:
> On 7 April 2016 at 10:08, Ralf Mardorf <silver.bullet at zoho.com> wrote:
>> On Thu, 7 Apr 2016 09:31:42 +0100, Colin Law wrote:
>>> ...
>>>There must be an answer to this problem, I am
>>>sure I am not the first to come across this issue.
>>
>> I guess you're right.
>>
>> Unfortunately there's no systemd user mailing list, perhaps requests for
>> help are allowed at the devel list,
>> https://lists.freedesktop.org/mailman/listinfo/.
>>
>
> OK, I think I have it. The answer (I hope) is to make A a oneshot
> service that starts the tunnel in the main thread, forks a
> supplementary process to carry on with the other tasks A has to
> perform, and sets RemainAfterExit so that systemd does not shutdown
> the forked process. Then A will not be considered started until it
> returns from the main thread, having setup the tunnel, and then B will
> be allowed to proceed.
>
> In fact I think a cleaner way will be to split A into A1, a oneshot
> process that opens the tunnel, and A2 that carries on with the tasks A
> performs, then A1 can have Before specs for A2 and B. I think that
> should do what I want.
Actually I think the above is not right. I should make A of
Type=forking and open the tunnel in the initial process, then fork a
process to continue with A's activities. A will not be considered
Started until it returns from the initial process, so then B should be
started. I have found a good explanation of that in the section on
Type= in
https://www.freedesktop.org/software/systemd/man/systemd.service.html
Colin
More information about the ubuntu-users
mailing list