Automatic Ksplice updates

Here is a little bit of shell script as a crontab that you can use to automate the checking of Ksplice kernel updates.  This particular one does the following:

  1. Activates at midnight every day, server time
  2. Checks if there are updates
  3. If there are updates available to the kernel, to automatically apply the update
  4. Once the update is applied, email the updates applied to the specified email address “youremail@address.com”

This script does not output anything if there are no updates to apply. Happy scripting!

0 0 * * * uptrack=`/usr/sbin/uptrack-upgrade -y`; uptrackCheck=`echo $uptrack | grep -o "Nothing to be done."`; if [[ $uptrackCheck != "Nothing to be done." ]]; then echo "$uptrack" | mail -s "Ksplice kernel upgraded" youremail@address.com; fi;

Some things that you can do to make it more interesting:

  • Also have it send you a text message on your phone, by emailing the SMS gateway of your service provider
  • Check more often, by modifying the crontab entry (don’t make it too often that you get blacklisted for abuse!)

Leave a Reply