[systemd-devel] Long Running Startup Dependency
Lennart Poettering
lennart at poettering.net
Mon Sep 10 19:55:15 UTC 2018
On Do, 09.08.18 18:19, Chuck Wolber (chuckwolber at gmail.com) wrote:
> 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?
I think that would be acceptable in this case, yes.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list