mysql-server

David Rees drees at greenhydrant.com
Tue Mar 29 22:14:16 UTC 2005


On Tue, March 29, 2005 9:48 am, Pettit, Paul said:
>
> I don't want to go to each and every machine (I have more than 1) and
> manually run yum to update them. It defeats the purpose of having cron.
> In fact Fedora Legacy's own documentation has a specific step for adding
> automatic updates (step 4 - 7.3 documentation). There is no mention that
> this process is NOT recommended by FL nor would I expect one. To limit
> people to manually acting on updates devalues FL's service below
> Microsoft.

I use a modified /etc/cron.daily/yum.cron to email me when a machine has
updates to apply.  I'll paste it in below.

To handle an automatic update for all machines, you could write a script
which goes out and runs yum update on all machines using ssh and public
key authentication so no manual intervention is required except to
initiate the command.  For example for the automatic update script:

#!/bin/sh
MACHLIST="mach1 mach2 mach3"
for i in $MACHLIST; do
	ssh root@$i yum -y update
done

You may want to use sudo instead of logging in directly as root.

For the daily script which tells me daily which machines need updating:

#!/bin/sh

if [ -f /var/lock/subsys/yum ]; then
	YUM="/usr/bin/yum"
	DEBUG="-e 0 -d 0"
	EMAIL="drees at greenhydrant.com"
	LOG=`mktemp -q /tmp/yum.XXXXXX`
	if [ $? -ne 0 ]; then
    	echo "$0: Can't create temp file for yum update, exiting..."
    	exit 1
	fi
	$YUM -R 120 $DEBUG list updates | grep -v \
		"No Packages Available to List" >> ${LOG}
	# Uncomment the next line to automatically update packages
	#$YUM -R 120 $DEBUG -y update >> ${LOG}
	if [ -s ${LOG} ] ; then
		cat ${LOG} | mail -s "Yum Update Alert `hostname`" ${EMAIL}
	else
		# No packages to update, clean the cache
		$YUM $DEBUG clean all
	fi

	rm -f ${LOG}
fi

Hope this helps.  Feel free to use these scripts as needed or post them on
the FAQ as necessary!

-Dave




More information about the fedora-legacy-list mailing list