From 9728596ba8cf819fe5255eb2aee9b2c469b8359c Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 9 Oct 2019 11:08:04 +0200 Subject: [PATCH] Retire dsa-is-shutdown-scheduled in favor of test -e /run/systemd/shutdown/scheduled --- .../debian_org/files/dsa-is-shutdown-scheduled | 15 --------------- .../files/molly-guard/15-acquire-reboot-lock | 2 +- modules/debian_org/manifests/init.pp | 3 +-- modules/mirror_health/files/mirror-health | 2 +- modules/nagios/templates/inc-debian.org.erb | 2 +- 5 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 modules/debian_org/files/dsa-is-shutdown-scheduled diff --git a/modules/debian_org/files/dsa-is-shutdown-scheduled b/modules/debian_org/files/dsa-is-shutdown-scheduled deleted file mode 100644 index 4dd1a7fb1..000000000 --- a/modules/debian_org/files/dsa-is-shutdown-scheduled +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# sysvinit -if /usr/lib/nagios/plugins/check_procs -w 1: -u root -C shutdown > /dev/null; then - exit 0 -fi -# jessie -if pgrep -u root -fx /lib/systemd/systemd-shutdownd > /dev/null; then - exit 0 -fi -# stretch -if busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager ScheduledShutdown 2> /dev/null | awk '$3 > 0 { t=$3 } END { exit (t == 0)}'; then - exit 0 -fi -exit 1 diff --git a/modules/debian_org/files/molly-guard/15-acquire-reboot-lock b/modules/debian_org/files/molly-guard/15-acquire-reboot-lock index c97861bfa..0bc2fdd3d 100644 --- a/modules/debian_org/files/molly-guard/15-acquire-reboot-lock +++ b/modules/debian_org/files/molly-guard/15-acquire-reboot-lock @@ -12,7 +12,7 @@ fi echo "Reboot lock acquired." ( - while dsa-is-shutdown-scheduled; do + while [ -e /run/systemd/shutdown/scheduled ]; do sleep 1 done ) & diff --git a/modules/debian_org/manifests/init.pp b/modules/debian_org/manifests/init.pp index cdf1e6273..be1fe7109 100644 --- a/modules/debian_org/manifests/init.pp +++ b/modules/debian_org/manifests/init.pp @@ -269,8 +269,7 @@ class debian_org { group => root, } file { '/usr/local/bin/dsa-is-shutdown-scheduled': - source => 'puppet:///modules/debian_org/dsa-is-shutdown-scheduled', - mode => '0555', + ensure => 'absent', } exec { 'dpkg-reconfigure tzdata -pcritical -fnoninteractive': diff --git a/modules/mirror_health/files/mirror-health b/modules/mirror_health/files/mirror-health index 025382e78..64845953e 100755 --- a/modules/mirror_health/files/mirror-health +++ b/modules/mirror_health/files/mirror-health @@ -40,7 +40,7 @@ def healthy(response): return False def check_shutdown(): - if subprocess.call(['dsa-is-shutdown-scheduled']) == 0: + if os.path.exists('/run/systemd/shutdown/scheduled'): logging.info("considering myself unhealthy, shutdown scheduled") return False return True diff --git a/modules/nagios/templates/inc-debian.org.erb b/modules/nagios/templates/inc-debian.org.erb index d641b827b..a7bc2d7eb 100644 --- a/modules/nagios/templates/inc-debian.org.erb +++ b/modules/nagios/templates/inc-debian.org.erb @@ -2,7 +2,7 @@ # if a system is running shutdown. We do not use check_nrpe's # exit code as that does not reliably tell us if the check could # not connect to the nrpe server or if the remote check returned not-null. -command[dsa2_shutdown]=if /usr/local/bin/dsa-is-shutdown-scheduled; then echo 'system-in-shutdown'; else echo 'no shutdown running' ; fi +command[dsa2_shutdown]=if [ -e /run/systemd/shutdown/scheduled ]; then echo 'system-in-shutdown'; else echo 'no shutdown running' ; fi command[restart-ekey]=sudo /usr/sbin/service ekeyd-egd-linux restart command[restart-samhain]=sudo /usr/sbin/service samhain restart command[restart-ekey]=sudo /usr/sbin/service ekeyd-egd-linux restart -- 2.20.1