#!/bin/bash #/etc/crond.daily/up2date.sh - Curt Kockx, Modified by Art Wildman 20051110 # #--- See /etc/sysconfig/rhn/up2date - or run 'up2date --config' & check 'pkgSkipList, # fileSkipList, noReplaceConfig, pkgsToInstallNotUpdate, updateUp2date, removeSkipList # if you are missing any required packages/updates. # #--- I changed my... #pkgSkipList=kernel*; #removeSkipList=kernel*; #--- To... #pkgSkipList=; #removeSkipList=; # #--- After editing restart the RHN up2date agent service... #[root@host]# service rhnsd restart # # This is considered dangerous, a bad kernel could corrupt the system or cause it # not to boot. I decided to try it on non-critical systems, That is what RHEL # Rescue CDs are for... ;) # # *** Finally, if you use this script, Change the email ADDRESS! *** # address='joeuser@redhat.com' host=$(hostname) run=$(date -I) success="Up2Date results for $host" failure="Up2Date *error* for $host" tmpfile=/tmp/up2date-cron.${run} rpmqalog=/tmp/rpmqalog.${run} # Update system /usr/sbin/up2date -ui --nox >| $tmpfile 2>&1 # List and alpha sort all RPMs installed /bin/rpm -qa | sort -f >| $rpmqalog 2>&1 #cat /etc/cron.daily/rpm # /etc/crond.daily/rpm - mod 'sort -f' 20050907 AW #rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ # | sort -f > /var/log/rpmpkgs # Mail reports - requires outbound only mailserver (try Postfix)... # http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-switchmail.html # http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client # # Comment out or delete, if you do not wish to receive email reports on up2date events. if [ -f $tmpfile ]; then echo "Up2date.${run} completed..." | /usr/bin/mutt -x -a $rpmqalog -s "$success" $address < $tmpfile else echo "The update failed to generate a log file." | mail -s "$failure" $address fi exit 0