diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-02-03 11:10:29 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-02-03 11:10:29 +0000 |
commit | acd2f5badb50a562eec3ce1a366799a47dcc61d4 (patch) | |
tree | 31d381677779611e51d6660b22166621586b5d71 /nagios-plugins/check_shutdown | |
parent | 2d09fecaba4a28a66b66fc216ee8bdf1f5fac8e0 (diff) | |
download | sitesummary-acd2f5badb50a562eec3ce1a366799a47dcc61d4.tar.gz sitesummary-acd2f5badb50a562eec3ce1a366799a47dcc61d4.tar.bz2 sitesummary-acd2f5badb50a562eec3ce1a366799a47dcc61d4.tar.xz |
Add three Nagios checks to detect bugs in /etc/resolv.conf, /etc/hosts
and a shutdown in progress.
Diffstat (limited to 'nagios-plugins/check_shutdown')
-rwxr-xr-x | nagios-plugins/check_shutdown | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nagios-plugins/check_shutdown b/nagios-plugins/check_shutdown new file mode 100755 index 0000000..756e6fb --- /dev/null +++ b/nagios-plugins/check_shutdown @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Report when a reboot is in progress. Useful to detect if +# reboot-when-idle have been used on a server. + +set -e + +PATH=/bin:/sbin:/usr/sbin:/usr/bin:/local/bin:/local/sbin + +shutdownpid="`pgrep '^shutdown$'|head -1`" + +if [ "$shutdownpid" ] ; then + case "`uname -s`" in + Linux) + cmd="`ps --no-headers --pid $shutdownpid -o command`" + echo "REBOOT IN PROGRESS: $cmd" + ;; + *) + echo "REBOOT IN PROGRESS" + ;; + esac + exit 1 +fi + +echo "OK - no shutdown running" +exit 0 |