Systemd service life cycle
clanlaw at gmail.com
Thu Apr 7 09:24:44 UTC 2016
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,
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.
More information about the ubuntu-users