I would like to negate the exit code of a command used in ExecCondition of a systemd service. However, I cannot use a "!" before the command, because this character is used by systemd for something slightly else (proceed, even if command fails ).
[Unit] Description=Negated Exec Condition [Service] Type=oneshot ExecCondition=/usr/bin/command # How can I negate the exit code? ExecStart=... [Install] WantedBy=default.target
You could run the shell.
ExecCondition=/bin/sh -c '! "$@"' -- /usr/bin/command