[systemd-devel] systemd-run unset OnFailure property

Etienne Champetier champetier.etienne at gmail.com
Thu May 16 17:43:13 UTC 2024


I'm trying to add a global OnFailure= to all the services and
excluding some non important services with /dev/null symlinks

Now when using systemd-run in some cases I also don't want to run the
OnFailure handler
I tried (and multiple small variations)
```
systemd-run --unit=test --service-type=oneshot --property=OnFailure=
--no-block -- /bin/false
```
it starts but it also run the OnFailure service

Any ideas / workaround ?

This is on Alma 9.3 (systemd-252-18.el9.x86_64) and Fedora 40
(systemd-255.6-1.fc40.x86_64)

```
cat > /usr/lib/systemd/system/onfailure-handler.service <<'EOF'
[Unit]
Description=onfailure handler
[Service]
Type=oneshot
ExecStart=/usr/bin/echo fail
EOF
mkdir -p /usr/lib/systemd/system/service.d/
cat > /usr/lib/systemd/system/service.d/10-onfailure.conf <<'EOF'
[Unit]
OnFailure=onfailure-handler.service
EOF
```


More information about the systemd-devel mailing list