ConditionPathExists= 和 ConditionPathExists=| 之间有什么区别?在系统中?
What is the Difference between ConditionPathExists= and ConditionPathExists=| in systemd?
在 Systemd 中启动我的服务之前,我需要检查一个文件不存在。我在 [Unit] 中看到两个案例:
ConditionPathExists=!/tmp/abc
和
ConditionPathExists=|!/tmp/abc
它们是一样的吗?谁能帮我解释一下它们是否不同?
有时您指定多个文件,例如:
ConditionPathExists=!/tmp/abc
ConditionPathExists=!/tmp/abe
现在,如果不满足任何条件,则不会启动服务。就像和操作一样。
现在如果你使用:
ConditionPathExists=|!/tmp/abc
ConditionPathExists=|!/tmp/abe
如果满足这些条件中的任何一个,它将运行服务。
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
这就像 OR 运算
在 Systemd 中启动我的服务之前,我需要检查一个文件不存在。我在 [Unit] 中看到两个案例:
ConditionPathExists=!/tmp/abc
和
ConditionPathExists=|!/tmp/abc
它们是一样的吗?谁能帮我解释一下它们是否不同?
有时您指定多个文件,例如:
ConditionPathExists=!/tmp/abc
ConditionPathExists=!/tmp/abe
现在,如果不满足任何条件,则不会启动服务。就像和操作一样。
现在如果你使用:
ConditionPathExists=|!/tmp/abc
ConditionPathExists=|!/tmp/abe
如果满足这些条件中的任何一个,它将运行服务。
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
这就像 OR 运算