Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WATCHDOG=trigger does not trigger watchdog actions. #5

Open
jclarijs opened this issue Aug 31, 2020 · 1 comment
Open

WATCHDOG=trigger does not trigger watchdog actions. #5

jclarijs opened this issue Aug 31, 2020 · 1 comment

Comments

@jclarijs
Copy link

jclarijs commented Aug 31, 2020

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.

@nurettin
Copy link

nurettin commented Apr 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants