Getting yum updates by E-mail

I run several CentOS 4.0 servers, and having to manually check each server for new updates is tedious. To simplify my life, I decided to write a shell script (yumnotifier) to E-mail me when new updates are available. The script (yumnotifier) analyzes the output from ‘yum check-update,’ and generates an E-mail similar to the following if updates are available:

From root@localhost.localdomain  Sat Jul 15 19:24:59 2006
Date: Sat, 15 Jul 2006 19:24:59 -0400
From: root 
To: matty@localhost.localdomain
Subject: Updates available for biscuit

==== The following updates are available for biscuit ===

comps.i386                               2:4.3CENTOS-0.20060314 base
gtk2.i386                                2.4.13-18              base
kernel.i686                              2.6.9-34.0.2.EL        update
libtiff.i386                             3.6.1-10               update
mysql.i386                               4.1.20-1.RHEL4.1       update
mysql-devel.i386                         4.1.20-1.RHEL4.1       update

If you manage systems that use yum, you might be interested in this script.

Viewing available updates on Fedora Core servers

In a previous blog entry I touched on the process I use to generate weekly patch reports for my Solaris servers. I support several Fedora Core servers as well, and use the following cron job to generate weekly update reports similar to the ones I receive from my Solaris hosts:

0 0 * * 0 /usr/sbin/check4updates | /usr/bin/mail -s “Patch list for `/usr/bin/hostname`” matty

The check4updates script will compare the currently installed packages with those available in the configured yum repositories, and print the available updates to stdout. I pipe the output from check4updates to the mail command, which in turn causes an email similar to the following to show up in my inbox:

From: Super-User 
To: matty
Subject: Patch list for pooh
Date: Sat, 15 Apr 2006 11:14:23 -0500 (EST)

Updates available for pooh
===
=== yum reports available updates:
===

ffmpeg.i386                              0.4.9-14_cvs20060301.r atrpms          
gnupg.i386                               1.4.3-0_32.rhfc5.at    atrpms          
libgcrypt.i386                           1.2.2-11.rhfc5.at      atrpms          
libgpg-error.i386                        1.3-0_8.rhfc5.at       atrpms          
libquicktime.i386                        0.9.8-15.rhfc5.at      atrpms          
lirc.i386                                0.8.1-cvs20060325_57.r atrpms          
mpeg2dec.i386                            0.4.0b-1.rhfc5.at      atrpms          
pm-utils.i386                            0.15-1.4cubbi_suspend2 atrpms          
sgml-common.noarch                       0.6.3-17_11.at         atrpms          
spamassassin.i386                        3.1.1-1_29.rhfc5.at    atrpms          
xml-common.noarch                        0.6.3-17_11.at         atrpms          
xvidcore.i386                            1.1.0-8.rhfc5.at       atrpms     

I digs me some Fedora core!