Skip to content

Instantly share code, notes, and snippets.

@hansdg1
Created March 23, 2018 14:36
Show Gist options
  • Save hansdg1/3116c25d82f5c7449976a43ef3563ebd to your computer and use it in GitHub Desktop.
Save hansdg1/3116c25d82f5c7449976a43ef3563ebd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#set -x
LAST_KERNEL=`/bin/rpm -q --last kernel | /usr/bin/head -1 | /usr/bin/perl -pe 's/^kernel-(\S+).*/$1/'`
RUNNING_KERNEL=`uname -r`
if [[ $LAST_KERNEL != $RUNNING_KERNEL ]];
then
echo "**Reboot pending**"
echo -e "Installed $LAST_KERNEL\nRunning $RUNNING_KERNEL" | column -t
else
echo "system OK"
fi
#rm $0
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment