bb4242/sdnotify

WATCHDOG=trigger does not trigger watchdog actions.

jclarijs opened this issue · 1 comments

As per sd_notify (https://www.freedesktop.org/software/systemd/man/sd_notify.html), it should be possible to trigger a service's watchdog action by sending a notification with "WATCHDOG=trigger".

I try to trigger the watchdog action using the following code:

import sdnotify
notifier = sdnotify.SystemdNotifier()

def trigger_watchdog():
    notifier.notify("WATCHDOG=trigger")

This does not result in watchdog actions for the relevant service (i.e. it should restart the service, but doesn't). When I use the following trigger_watchdog function instead, the service is restarted as expected:

def trigger_watchdog():
    import subprocess
    subprocess.check_output(["systemd-notify", "WATCHDOG=trigger"])

I suspect the systemd-notify is parsing the "WATCHDOG=trigger" argument in some way, but haven't been able to find its source code.

Any help would be appreciated! I can upload a test service file + python script in order to reproduce this, if anybody looks into this.

I see that some systemd notifiers put a \n after the message, so maybe try WATCHDOG=trigger\n instead