Archives

Categories

Rackspace RHEL4 updates

A default RHEL4 install of a Rackspace (*) server contains a cron.d file named /etc/cron.d/rs_rhncheck that runs a job to check for Red Hat Network updates. In the default configuration this would send out a message every day indicating that up2date did nothing. To only get email when there is something interesting happening I changed the cron.d file to call the following script. The checksum is compared against the checksum of the output of up2date when it does nothing (I guess I could have tested the return code for diff). So when up2date either installs a package or decides not to install a new kernel package (or other important package) then I get an email.

#/bin/sh
/usr/sbin/up2date --nox -u > ~/up2date.out
SUM=`md5sum ~/up2date.out | cut -f1 -d\ `
if [ $SUM != "65c57b05b24bd8f656a0aec0d6db725a" ] ; then
  cat ~/up2date.out
fi

(*) Rackspace support is really good. If I was paying I might look at other options but for my clients I am happy to recommend them without hesitation.

1 comment to Rackspace RHEL4 updates

  • Tomas H.

    Hi Russell!

    I have written following script to get similar functionality to cron-apt configured in download-only mode. I will get notification email if my system is not fully updated. Update rpms are downloaded, so they can be immediately installed.

    It is trivial to modify this script to automatically install updates.

    #!/bin/bash
    #
    # show available updates
    # up2date version

    DOWNLOAD_UPDATES=”yes”

    UP2DATE_OUT=”`up2date -l | sed ‘0,/^—–/d’`”

    if [ “$UP2DATE_OUT” != “`echo -e ‘\n’`” ]; then

    if [ “$DOWNLOAD_UPDATES” = “yes” ]; then

    echo ‘Downloading updated RPMs:’
    echo ‘————————-‘
    up2date -u -d

    else

    echo ‘Out of date packages:’
    echo ‘———————‘
    echo

    echo “$UP2DATE_OUT”
    echo

    fi

    fi