Commit 8e71f6ad authored by Jameson Rollins's avatar Jameson Rollins

systemd notification

for READY, WATCHDOG, and STOPPING
parent 453abd1a
......@@ -5,11 +5,15 @@ import time
import threading
import logging
import traceback
try:
from setproctitle import setproctitle
except:
def setproctitle(*args): pass
try:
import systemd.daemon.notify as sd_notify
except ImportError:
def sd_notify(*args):
pass
############################################################
......@@ -381,6 +385,7 @@ guardian version: {}
def stop(self):
# FIXME: what actions do we need to do here?
sd_notify("STOPPING=1")
self.log.info("stopping daemon...")
self.worker_terminate()
self.clock_terminate()
......@@ -413,6 +418,7 @@ guardian version: {}
self.worker_init()
self.log.info("========== executing run loop ==========")
sd_notify("READY=1")
########################################
########################################
......@@ -420,6 +426,7 @@ guardian version: {}
self.clock.wait()
self.log.log(5, '====== start cycle ======')
sd_notify("WATCHDOG=1")
########################################
# bookeeping to be done every cycle
......
......@@ -3,6 +3,8 @@ Description=Advanced LIGO Guardian service: %i
After=network-online.target
[Service]
Type=notify
WatchdogSec=3
Slice=guardian.slice
EnvironmentFile=/etc/guardian/local-env
Environment=GUARD_LOG_NOTIME=true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment