dsa-is-shutdown-scheduled: rewrite the systemd-shutdownd test using pgrep
[mirror/dsa-puppet.git] / modules / debian_org / files / dsa-is-shutdown-scheduled
1 #!/bin/sh
2
3 # sysvinit
4 if /usr/lib/nagios/plugins/check_procs -w 1: -u root -C shutdown > /dev/null; then
5         exit 0
6 fi
7 # jessie
8 if pgrep -u root -fx /lib/systemd/systemd-shutdownd > /dev/null; then
9         exit 0
10 fi
11 # stretch
12 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
13         exit 0
14 fi
15 exit 1