[systemd-devel] oneshot service
Ivan Shapovalov
intelfx100 at gmail.com
Tue Jul 7 14:36:27 PDT 2015
On 2015-07-07 at 13:04 -0400, Ernast Sevo wrote:
> Apologies that was mistakenly sent. The example service is below.
>
> [Unit]
> Before=local-fs.target
> After=<some service>
> DefaultDependencies=false
>
> [Service]
> Type=oneshot
> ExecStart=/usr/bin/xxx
> RemainAfterExit=yes
>
> [Install]
> WantedBy=local-fs.target
>
> The problem is I can see boot-up continue prior to this service doing
> its job. I am not sure if I am missing
> something but I haven't come across anything in the documentation
> that
> can help. The service finishes its job
> later but something's that depend on it have already failed and have
> not waited for it to finish doing what it is doing.
>
> Any thoughts as to what could be causing this?
Two questions.
1) Does the /usr/bin/xxx program fork? A fork will not be waited for;
systemd will consider the unit "active" right when the initially
started process exits.
2) Remember, in absence of ordering dependencies (Before=/After=)
everything in systemd is started in parallel. Oneshot services are not
an exception: they do not pause everything, they are just kept in
"starting" state until the process exits.
What exactly do you want to serialize against start-up of your service?
Side-note: Most "common" services will get implicitly ordered after
your service with a chain like this:
xxx.service -> local-fs.target -> sysinit.target -> basic.target -> ...
However, early-boot services (which have "DefaultDependencies=false" as
well) will _not_ get ordered against your service in any way.
HTHs,
--
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150708/41c4388c/attachment.sig>
More information about the systemd-devel
mailing list