[systemd-devel] Q: ConditionPathExists=

Reindl Harald h.reindl at thelounge.net
Tue Jun 4 11:56:04 UTC 2019



Am 04.06.19 um 13:51 schrieb Reindl Harald:
> 
> 
> Am 04.06.19 um 13:32 schrieb Ulrich Windl:
>> Hi!
>>
>> I have a question for ConditionPathExists:
>> If I specify two files like "ConditionPathExists=/etc/idredir.conf /etc/isredir.conf", I get a "start condition failed" even if both files exist.
> 
> why don't you just use
> 
> ConditionPathExists=/etc/idredir.conf
> ConditionPathExists=/etc/isredir.conf
> 
>> There's also some confusion where exactly a pipe sysmbol has to be placed:
>>            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
>>
>> Do I have to write "|ConditionPathExists=..." or "ConditionPathExists=|..."
> 
> ConditionPathExists=|

BTW:

you could really make your life easier by looking at existing units

[root at srv-rhsoft:/usr/lib/systemd/system]$ cat *.service | grep
ConditionPathExists
ConditionPathExists=!/etc/alsa/state-daemon.conf
ConditionPathExists=/etc/alsa/state-daemon.conf
ConditionPathExists=/etc/ethers
ConditionPathExists=/etc/krb5.keytab
ConditionPathExists=/dev/tty0
ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-bootup.oga
ConditionPathExists=|/usr/share/sounds/freedesktop/stereo/system-shutdown.oga
ConditionPathExists=|/usr/share/sounds/freedesktop/stereo/system-shutdown-reboot.oga
ConditionPathExists=/usr/share/sounds/freedesktop/stereo/system-shutdown.oga
ConditionPathExists=/dev/console
ConditionPathExists=/dev/pts/%I
ConditionPathExists=/dev/tty9
ConditionPathExists=!/run/ostree-booted
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/lib/dracut/need-initqueue
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=|/dev/root
ConditionPathExists=|/dev/nfs
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExists=/usr/lib/initrd-release
ConditionPathExistsGlob=|/etc/cmdline.d/*.conf
ConditionPathExists=!/run/initramfs/bin/sh
ConditionPathExists=/dev/tty0
ConditionPathExists=/etc/initrd-release
ConditionPathExists=/etc/initrd-release
ConditionPathExists=/etc/initrd-release
ConditionPathExists=/etc/initrd-release
ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
ConditionPathExists=/etc/mdadm.conf
ConditionPathExists=/etc/sysconfig/monitor-httpd
ConditionPathExists=/usr/bin/monitor-httpd.php
ConditionPathExists=/usr/bin/php
ConditionPathExists=/etc/krb5.keytab
ConditionPathExists=/etc/sysconfig/network
ConditionPathExists=/usr/sbin/quotaon
ConditionPathExists=/etc/krb5.keytab
ConditionPathExists=!/.autorelabel
ConditionPathExists=!/run/plymouth/pid
ConditionPathExists=/etc/initrd-release
ConditionPathExists=|!/usr/lib/udev/hwdb.bin
ConditionPathExists=|/etc/udev/hwdb.bin
ConditionPathExists=/usr/sbin/quotacheck
ConditionPathExists=/etc/fstab
ConditionPathExists=/dev/tty0


More information about the systemd-devel mailing list