Skip to content

Instantly share code, notes, and snippets.

@johnteslade
Created February 15, 2015 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnteslade/0357c3435d49ebf204c7 to your computer and use it in GitHub Desktop.
Save johnteslade/0357c3435d49ebf204c7 to your computer and use it in GitHub Desktop.
Nagios plugin for ubuntu machine needing reboot
#!/bin/bash
# Nagios plugin to check if a machine needs to be rebooted after run apt
# Original source http://serverfault.com/a/268528/41649
if [ ! -f /var/run/reboot-required ]; then
# no reboot required (0=OK)
echo "OK: no reboot required"
exit 0
else
# reboot required (1=WARN)
echo "WARNING: `cat /var/run/reboot-required`"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment