You are not logged in.

#1 2025-06-12 11:11:01

omar123
Member
Registered: 2019-01-28
Posts: 2

[SOLVED] Override systemd override

I have a systemd user service to notify me anytime a service fails:

[Unit]
Description=Send notifications when other services fail

[Service]
Type=simple
ExecStart=notify-send -u normal "%I failed"

I apply it in service.d/10-all.conf:

[Unit]
OnFailure=notify-failed@%n

However, I have one service for which I would like this to not apply (because it fails a lot and there seems to be nothing I can do about it, so I just want it to quietly restart). I've tried creating an override just for that service, but it seems you can't clear OnFailure. Is there a way to apply my override for every service except one?

Last edited by omar123 (2025-06-12 13:54:24)

Offline

#2 2025-06-12 13:46:23

seth
Member
Registered: 2012-09-03
Posts: 65,047

Re: [SOLVED] Override systemd override

it seems you can't clear OnFailure

idk whether that's the case, but you could discriminate the services in the failure script (ie. run some bash script instead of notify-send and there test $1)

Offline

#3 2025-06-12 13:54:11

omar123
Member
Registered: 2019-01-28
Posts: 2

Re: [SOLVED] Override systemd override

As I wrote the post I rubber ducked myself into realizing I could just filter the notification in dunst, which I guess is as good a solution as any.

I then tried looking into why OnFailure can't be cleared (I remember reading about this a while ago while trying to fix this), but instead found out about RestartMode=direct which lets you skip OnFailure. This is clean enough for me, so I'll consider this solved.

Offline

Board footer

Powered by FluxBB