Thao Nguyen Thao Nguyen - 1 year ago 233
Linux Question

What is the Difference between ConditionPathExists= and ConditionPathExists=| in systemd?

I need check a file not exist before i start my service in Systemd. I see two case in [Unit]:




are they the same? Can anybody help me explain if they are different?

Answer Source

Sometime you specify multiple files like:


Now if any of the condition isn't satisfied, it doesn't start service. It's like and operations.

Now if you use:


If any of these conditions is satisfied, it will run the service.

Condition checks can be prefixed with a pipe symbol (|) in which case a condition becomes a triggering condition. If at least one triggering condition is defined for a unit, then the unit will be executed if at least one of the triggering conditions apply and all of the non-triggering conditions

It's like OR operations