Skip to content

Instantly share code, notes, and snippets.

@rjaeckel
Last active August 29, 2015 14:06
Show Gist options
  • Save rjaeckel/1519346b82c99bee6eb4 to your computer and use it in GitHub Desktop.
Save rjaeckel/1519346b82c99bee6eb4 to your computer and use it in GitHub Desktop.
Verifiy active kernel is the latest installed
#!/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