summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/modules/sunet/templates
diff options
context:
space:
mode:
authorJohan Lundberg <lundberg@nordu.net>2015-04-23 15:27:36 +0200
committerJohan Lundberg <lundberg@nordu.net>2015-04-23 15:27:36 +0200
commit87f3dd641ef54be88f77655b0f4b70557d397fcd (patch)
tree96baf238811294efcdcbbb1a630d9b414b4d989f /global/overlay/etc/puppet/modules/sunet/templates
parente9f06d2ec17be72874fa30f310f8f41bbd695530 (diff)
parent0008d057cde159d7039c5f93fe69d5b9f7ee6bfb (diff)
Merge branch 'master' of git.nordu.net:sunet-opssunet-ops-2015-04-23-v01
Diffstat (limited to 'global/overlay/etc/puppet/modules/sunet/templates')
-rwxr-xr-xglobal/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb37
1 files changed, 37 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb
new file mode 100755
index 0000000..aa0bd5d
--- /dev/null
+++ b/global/overlay/etc/puppet/modules/sunet/templates/nagioshost/check_reboot.erb
@@ -0,0 +1,37 @@
+#!/bin/bash
+declare -rx PROGNAME=${0##*/}
+declare -rx PROGPATH=${0%/*}/
+
+function cleanup {
+ #if [ -e "$TMPFILE" ] ; then
+ #rm "$TMPFILE"
+ #fi
+ exit $1
+}
+
+if [ -r "${PROGPATH}utils.sh" ] ; then
+ source "${PROGPATH}utils.sh"
+else
+ echo "Can't find utils.sh."
+ printf "Currently being run from %s\n" "$PROGPATH"
+ # since we couldn't define STATE_UNKNOWN since reading utils.sh failed, we use 3 here but everywhere else after this use cleanup $STATE
+ cleanup 3
+fi
+
+STATE=$STATE_UNKNOWN
+
+
+if [ -f /var/run/reboot-required.pkgs ]
+then
+ pkg=`cat /var/run/reboot-required.pkgs`
+fi
+
+if [ -f /var/run/reboot-required ]
+then
+ echo "Reboot WARNING: System reboot required by package $pkg"
+ cleanup $STATE_WARNING;
+fi
+ echo "Reboot OK: No reboot required"
+ cleanup $STATE_OK;
+cleanup $STATE;
+