2

I have a service of type 'notify' that uses a watchdog script. The service restarts automatically (restart=always).

I want to run a (bash) script whenever the service restarts due to a crash or due to a watchdog trigger. The custom script should not be ran when the service is stopped/started through systemd (using eg. systemctl).

The 'OnFailure' hook is not working because the service is restarting automatically and thus never reaches a failed state.

1 Answer 1

0

The ExecStopPost commands get the $SERVICE_RESULT environment variable, which looks like it should allow you to only perform an action when the service fails.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .