[systemd-devel] Service not restarting after Condition failed

Umut Tezduyar Lindskog umut at tezduyar.com
Mon Nov 24 11:30:25 PST 2014


Hi

On Monday, November 24, 2014, D.S. Ljungmark <spider at aanstoot.se> wrote:

> On 10/11/14 23:09, Lennart Poettering wrote:
> > On Thu, 30.10.14 18:47, D.S. Ljungmark (spider at aanstoot.se
> <javascript:;>) wrote:
> >
> >> Hi
> >>  we have a service set to:
> >> ConditionFileNotEmpty=
> >>
> >> and
> >>
> >> Restart=Always
> >>
> >>
> >> This combination would (in my feebled mind) cause the service to restart
> >> once the Condition was fulfilled, but that doesn't seem to be the
> >> case.
> >
> > Conditions are something that are on-time evaluated right before we
> > would start a unit, and cause this starting to be shortcut. That's all
> > really. Restarts are only triggered when a running service dies, and
> > the start job queued by that will then check the conditions again. If
> > the condition doesn't hold then this start will not be executed, and
> > hence no restart ever again either...
> >
> >> Is there a way I can get a service to restart even after it has been set
> >> as inactive (dead) "start condition failed"?
> >
> > Nope, conditions are not for that. For the specific check of
> > file-not-empty there's no nice way to handle this, however for
> > directory-not-empty you could set up DirectoryNotEmpty=...
> >
> >> Should I simply remove the Condition, or something else?
> >
> > What precisely are you trying to do?
> >
> > Lennart
>
> Basically, some files (config & certificates) may not exist on a system
> until it's provisioned properly, something that may take a while ( a few
> days)
>
> After provisioning, we want the services depending on those file to
> start automatically.


Path unit files should work for you,
http://www.freedesktop.org/software/systemd/man/systemd.path.html

Umut

>
> //D.S.
>
>
> --
> 8362 CB14 98AD 11EF CEB6  FA81 FCC3 7674 449E 3CFC
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141124/398b6157/attachment-0001.html>


More information about the systemd-devel mailing list