EnderUNIX Team.


EnderUNIX tips

Mail to My Friend , Home Page

[ Linux ]

"Get Important Update Notification on Linux Using Bash Script" - Ugur Engin - (2012-03-25 12:51:44)   [13975]

This script is checking which important updates are available on your system using yum package management.If you want to use this script,you got to write related to package name between the loop line before run this script.So when you set its name in script of course you are going to have update notification from your system with email while important updates are available.

#!/bin/bash
#Author=Ugur Engin
server=`hostname`
int_del=/bin/rm
email="eposta"
function send_email() {
subject="Available Important Updates!"
value="0"
printf "Please review the updates to apply your system:\n\nServer: $server\n\n"> $value
echo "$cmd" >> $value
/bin/mail -s "$subject" "$email" < $value
$int_del $value
}
for i in "kernel|httpd|mysql";
do
cmd=`yum check-update | awk '{if($1 ~/'$i'/) print $1,$2}' |uniq |sort`
done
if [[ "$cmd" != "" ]]
then
send_email
else
exit 1
fi

Mail to My Friend , Home Page