Yum: Checking for updates.
Friday, September 23rd, 2005Here’s a quick script you can put in your cron rotation to check and see if there are any updates available and what they are:
#!/bin/bash
yum_output=/tmp/yum-check-update-output.txt
python=/usr/bin/python1.5
yum=/usr/bin/yum
$python $yum check-update > $yum_output
yum_return_code="$?"
case $yum_return_code in
100)
# Packages available for update.
echo '********************************************************'
echo "The following packages need to be udpated on $HOSTNAME"
echo '********************************************************'
echo ''
cat $yum_output
;;
0)
# No packages available for update.
;;
*)
echo "YUM: Undefined return code: $yum_return_code ."
exit 1
esac
exit 0














