In the manual of systemd.path, it is said that the "conditions" can be combined, however it is not said how.

I guess it is a logical "and", and if you want to do a logical "or" you should use multiple path triggering the same target. Am I right?

Edit: As an example, I have a A.path triggered for a certain amount of time by a timer, it triggers A.service that empty a queue folder.

  • If queue is not empty when A.path is triggered, I want A.service to start; DirectoryNotEmpty do this.

  • If file are added to queue during the functionning period, I also want it to start; PathModified monitors files added/removed, but only during the functioning period and won't trigger the service if the files have been added outside of the functioning period.

So in the end, I want it to run if the queue directory is not empty when started, or if the content of queue is modified during the functioning period.

How can I do this?


Use a vertical pipe before each condition that stands alone.

From the freedesktop manual page:

If multiple conditions are specified, the unit will be executed if all of them apply (i.e. a logical AND is applied). 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.

  • Sorry I was not clear enough, I did not mean conditions but the [Path] options like DirectorNotEmpty. – Abitbol Jul 12 at 14:39
  • I have added an example to give some context. – Abitbol Jul 12 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.