Weekly errata Report for YUM based machines

By | 2009/10/10

I had a request the other day at the Utah Open Source Conference to share a very small script that I have that checks for, and reports any available updates on a YUM based machine. This means CentOS, RHEL, Fedora, etc. I have been using this script at work for some time now and, by placing it in the /etc/cron.weekly/ directory, it reports to me on what packages are available for update. I find this to be a simpler solution than manually checking and trying to keep on top of all of my machines all the time.

I have outlined two revisions of this script below. The first one has properly formatted reports, the second one only reports if there are available updates. I would like to combine the functionality, but I’ve only briefly looked at doing so.. and I don’t feel like doing it now.

If anyone has any other solutions, or perhaps an official program with the same functionality I’d love to hear about it.

/etc/cron.weekly/check-update.sh – revision #1

#!/bin/bash
#
# Weekly check-update report
#
usr/bin/yum check-update > /tmp/.check-update
cat /tmp/.check-update | mail -s "Errata Report for $(hostname)" [email protected]

/etc/cron.weekly/check-update.sh – revision #2

#!/bin/bash
#
# Weekly check-update report
#
MESSAGE=$(/usr/bin/yum check-update)
if [ $? -eq 100 ]; then
echo ${MESSAGE} | mail -s "Errata Report for $(hostname)" [email protected]
fi

One thought on “Weekly errata Report for YUM based machines

  1. Clint

    Thanks for posting this. I enjoyed all three of your presentations at UTOSC 2009 and visiting with you in the table area as the conference was coming to a close. You mentioned that you would be posting your gconf script here?

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.