[systemd-devel] How to set multiple condition to service file

Jiwon Kim jwkim0000 at gmail.com
Tue Nov 3 04:38:37 PST 2015


Hi systemd-experts,

I'm develop some daemon and it starts on booting time.
But my daemon doesn't has any reason, if there is no 3rd party app.
So, I will set to start condition using "ConditionDirectoryNotEmpty" option.


Bellow is simple test and I checked working successfully.

[Unit]
Description=test1
ConditionDirectoryNotEmpty|=/foo
ConditionDirectoryNotEmpty|=/bar

[Service]
ExecStart=/usr/bin/test1

[Install]
WantedBy=multi-user.target


In this case, starting condition is like this

if (/foo is not empty) or (/bar is not empty) then
    start.



But, I hope to set complex condition like this
if (/foo is not empty) or ((/bar is not empty) and (/baz is not empty)) then
    start.

I expected bellow setting but it didn't worked.

[Unit]
Description=test2
ConditionDirectoryNotEmpty|=/foo
ConditionDirectoryNotEmpty|=/bar
ConditionDirectoryNotEmpty=/baz

[Service]
ExecStart=/usr/bin/test2

[Install]
WantedBy=multi-user.target


Does any know how to set condition?

-- Jiwon Kim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151103/d9f31e23/attachment.html>


More information about the systemd-devel mailing list