Last active
August 29, 2015 14:06
-
-
Save rjaeckel/1519346b82c99bee6eb4 to your computer and use it in GitHub Desktop.
Verifiy active kernel is the latest installed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# u may use this script in cron or in the shell directly. Should work on any Linux distribution | |
# an alternative would be checking for /var/run/reboot-required to exist | |
running=$(uname -r) | |
kernels=/lib/modules | |
installed=($(ls $kernels)) | |
latest=${installed[@]:(-1)} | |
if [[ $latest == $running ]]; then | |
if [[ -t 0 ]]; then echo running latest installed kernel version: $running; fi | |
else | |
echo reboot required $latest active: $running | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment