[systemd-devel] Long Running Startup Dependency

Chuck Wolber chuckwolber at gmail.com
Fri Aug 10 01:19:05 UTC 2018


Is it generally considered bad form to start up a service unit from within
an application?

I have been trying to keep everything under the direct control of systemd,
but I ran in to a problem that I am not quite sure how to resolve and still
keep systemd in control of everything.

I have a daemon service that absolutely cannot be started until a test
passes. I also do not have the ability to alter this daemon, except for
overriding its service unit with drop-ins.

The test depends on another server that might be up, or it could possibly
be down for days.

One possibility is to set up "foo-test.service" with Type=oneshot whose
ExecStart= does not exit until the test passes. By amending the dependent
service with After=foo-test.service and Requires=foo-test.service I solve
the problem.

But the target unit does not finish until service foo-test.service finishes
- systemctl list-jobs shows the jobs. This would be all well and good, but
our environment dictates that we occasionally isolate to a different
target. With jobs waiting, we cannot isolate to a different target.

Should I just go ahead and set Type=simple in service foo-test.service and
bury "systemctl start foo.service" in the script called from ExecStart=
once the test passes?

Or is there a way to solve the "Long Running Startup Dependency" problem
purely in systemd? It seems like "AfterOneshot=" should exist, which treats
the parent as a Type=oneshot even if it is Type=simple.

..Ch:W..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180809/bdc7341a/attachment.html>


More information about the systemd-devel mailing list