Skip to content

Instantly share code, notes, and snippets.

@a-nldisr
Last active August 29, 2015 14:26
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 a-nldisr/bf1b1b827dbe5bc01377 to your computer and use it in GitHub Desktop.
Save a-nldisr/bf1b1b827dbe5bc01377 to your computer and use it in GitHub Desktop.
#!/bin/env bash -eq
NEXTLINE=0
FIND=""
RESULT=""
for I in `file /boot/vmlinuz*`; do
if [ ${NEXTLINE} -eq 1 ]; then
FIND="${I}"
NEXTLINE=0
else
if [ "${I}" = "version" ]; then NEXTLINE=1; fi
fi
done
if [ ! "${FIND}" = "" ]; then
CURRENT_KERNEL=`uname -r`
if [ ! "${CURRENT_KERNEL}" = "${FIND}" ]; then
echo "Boot required"
exit 1; else
echo "All is goooood"
exit 0
fi
fi
for U in `uptime`; do
if [ ${NEXTLINE} -eq 1 ]; then
RESULT="${U}"
NEXTLINE=0
else
if [ "${U}" = "up" ]; then NEXTLINE=1; fi
fi
done
if [ ! "${RESULT}" = "" ]; then
MAX_UP=150
if [ "${MAX_UP}" -le "${RESULT}" ]; then
echo "Uptime too High, Check for a Kernel update"
exit 2
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment