Skip to content

Weekly errata Report for YUM based machines

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)" admin@example.com

/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)" admin@example.com
fi

If this site has been helpful, please consider a donation.

Other Points of Interest

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

One Comment

  1. 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?

    Posted on 12-Oct-09 at 2:37 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*