cron job question (for checking kernel updates)

inode0 inode0 at gmail.com
Thu Oct 3 01:53:52 UTC 2013


On Wed, Oct 2, 2013 at 10:10 AM, Ranjan Maitra
<maitra.mbox.ignored at inbox.com> wrote:
> Hi,
>
> I have a cron job running which yum updates all my machines once a day.
> All of these work fine.
>
> I also have a cron job which checks for kernel updates every hour and
> sends me a message if an updated kernel has been installed. Here is the
> relevant script:
>
> --- begin file called check-kernel.sh in my scripts/yum directory---
>
> #!/bin/bash

export DISPLAY=:0

> latestkernel=$(rpm -q kernel |tail -n1|sed -e 's/kernel-//')
>
> #echo "$latestkernel"
>
> if uname -a | grep -qv "$latestkernel"; then
> notify-send "Kernel UPDATE on ${HOSTNAME}: Running Kernel is $(uname
> -r) but lat est installed rpm is ${latestkernel}; REBOOT required"
> fi;
>
>
> --- end file called check-kernel.sh ---

Give that a try if you haven't yet Ranjan.

John


More information about the users mailing list