import time
import calendar
import logging
+import subprocess
from email.utils import parsedate
logging.basicConfig(level=logging.INFO)
lm = calendar.timegm(parsedate(response.headers['last-modified']))
return lm
+def check_shutdown():
+ if subprocess.call(['dsa-is-shutdown-scheduled']) == 0:
+ logging.info("considering myself unhealthy, shutdown scheduled")
+ return False
+ return True
+
def check_uptodate():
global latest_ts
for host in HOSTS:
while True:
start = time.time()
- if check_uptodate():
+ if check_shutdown() and check_uptodate():
logging.info("considering myself healthy")
open(HEALTH_FILE, 'w').write("OK")
else: