yum.cron for testing & examination

"David L. Parsley" <[email protected]>
Newsgroups gmane.linux.tao.general
Message-ID <1097181849.26668.93.camel__43080.5938238793$1097181965$gmane$org@eowyn.alfred.edu>
Hi all,

Finally, after chatting w/ Seth about the 'yum hangs' problem, I hear
that there's really no good solution for python-2.2 based systems, like
Tao.  Since this problem is really bad in yum.cron (quietly stops your
server from updating), I've put created a yum.cron with a configurable
timeout - 12h default, 0 disables.  If you know an easier way to
accomplish timeouts with bash in a clean way (not leaving cruft
processes hanging around) let me know.

Anyway, you can read the attached script and try replacing your yum.cron
with it.  I'm going to test it for a bit before folding it into Tao yum,
but after some testing with 'set -x' I'm pretty confident it will work.

Feedback welcome - desired even.

regards,
	David

_______________________________________________
Tao-discuss mailing list
[email protected]
http://mailman.taolinux.org/mailman/listinfo/tao-discuss
yum.cron (text/x-sh, 757 B)
#!/bin/sh

[ -f /etc/sysconfig/yum ] && . /etc/sysconfig/yum

[ -n "$YUMTIMEOUT" ] || YUMTIMEOUT=12h

killtimer () {
	YPID=$1
	sleep $YUMTIMEOUT &
	SLPID=$!
	trap "kill $SLPID; exit 1" SIGTERM
	wait $SLPID
	kill -9 $YPID >/dev/null 2>&1
	mail -s "Yum nightly timed out" root <<EOF
The nightly yum update process was killed after running for $YUMTIMEOUT.
EOF
}

timedyum () {
	YUMARGS=$*	
	if [ "$YUMTIMEOUT" != "0" ]
	then
		/usr/bin/yum $YUMARGS &
		YPID=$!
		killtimer $YPID &
		KPID=$!
		wait $YPID >/dev/null 2>&1
		if [ $? -eq 0 ]
		then 
			kill $KPID
		fi
	else
		/usr/bin/yum $YUMARGS
	fi
}

if [ -f /var/lock/subsys/yum ]; then
	timedyum -R 10 -e 0 -d 0 -y update yum
	timedyum -R 120 -e 0 -d 0 -y update
fi
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQBBZaqZ4J4WoZuSf3URAqqcAJ4u/A298Qq0bBGuLnkqgkLKtgoeogCg3G7K
NrPGztUbFcEtkBrRVHPm8NY=
=qCNR
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.