[systemd-devel] Service not restarting after Condition failed

D.S. Ljungmark spider at aanstoot.se
Mon Nov 24 11:02:24 PST 2014


On 10/11/14 23:09, Lennart Poettering wrote:
> On Thu, 30.10.14 18:47, D.S. Ljungmark (spider at aanstoot.se) 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.

//D.S.


-- 
8362 CB14 98AD 11EF CEB6  FA81 FCC3 7674 449E 3CFC

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141124/820011ee/attachment.sig>


More information about the systemd-devel mailing list