SCIENTIFIC-LINUX-DEVEL Archives

October 2011

SCIENTIFIC-LINUX-DEVEL@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Kevan Benson <[log in to unmask]>
Reply To:
Kevan Benson <[log in to unmask]>
Date:
Wed, 26 Oct 2011 17:53:09 -0700
Content-Type:
multipart/mixed
Parts/Attachments:
text/plain (284 bytes) , yum-autoupdate.patch (2970 bytes)
On 10/26/2011 03:16 PM, Kevan Benson wrote:
>
> Attached are patches to extend the functionality of yum-autoupdate to
> allow pre/post actions to be defined for more custom usage.

Whoops, typo in a variable in the first patch ignored output from 
POSTRUN in mailings.  Fixed.

-Kevan
-Sonic.net




diff -rU2 yum-autoupdate-2/etc/cron.daily/yum-autoupdate yum-autoupdate-2.new/etc/cron.daily/yum-autoupdate --- yum-autoupdate-2/etc/cron.daily/yum-autoupdate 2011-08-15 08:19:27.000000000 -0700 +++ yum-autoupdate-2.new/etc/cron.daily/yum-autoupdate 2011-10-26 17:48:47.841327118 -0700 @@ -112,5 +112,7 @@   TEMPFILE="`mktemp /tmp/yum.temp.XXXXXXXXXX`"   TEMPCONFIGFILE="`mktemp /tmp/yum.temp.config.XXXXXXXXXX`" + TEMPPRERUNFILE="`mktemp /tmp/yum.temp.prerun.XXXXXXXXXX`"   TEMPMAILFILE="`mktemp /tmp/yum.temp.mail.XXXXXXXXXX`" + TEMPPOSTRUNFILE="`mktemp /tmp/yum.temp.postrun.XXXXXXXXXX`"   TEMPRANDFILE="`mktemp /tmp/yum.temp.rand.XXXXXXXXXX`"   TODAY="$(date +%Y-%m-%d)" @@ -132,4 +134,21 @@   check_yum   + #**************************** + #PRERUN + #**************************** + if [ "$PRERUN" != "" ]; then + if [ "$DEBUG" = "true" ] ; then + echo "Executing PRERUN: $PRERUN" + fi + if [ "$SENDONLYERRORS" = "true" ] ; then + eval $PRERUN >/dev/null 2> $TEMPPRERUNFILE + else + eval $PRERUN &> $TEMPPRERUNFILE + fi + if [ "$DEBUG" = "true" ] ; then + echo "PRERUN output:" + cat $TEMPPRERUNFILE + fi + fi      #**************************** @@ -204,4 +223,21 @@    #****************************   + #**************************** + #POSTRUN + #**************************** + if [ "$POSTRUN" != "" ]; then + if [ "$DEBUG" = "true" ] ; then + echo "Executing POSTRUN: $POSTRUN" + fi + if [ "$SENDONLYERRORS" = "true" ] ; then + eval $POSTRUN >/dev/null 2> $TEMPPOSTRUNFILE + else + eval $POSTRUN &> $TEMPPOSTRUNFILE + fi + if [ "$DEBUG" = "true" ] ; then + echo "POSTRUN output:" + cat $TEMPPOSTRUNFILE + fi + fi     #**************************** @@ -223,5 +259,5 @@   echo " /bin/mail -s \"YUM:$HOSTNAME:$TODAY\" $MAILLIST "   fi - /bin/mail -s "YUM:$HOSTNAME:$TODAY" $MAILLIST < $TEMPMAILFILE + cat $TEMPPRERUNFILE $TEMPMAILFILE $TEMPPOSTRUNFILE | /bin/mail -s "YUM:$HOSTNAME:$TODAY" $MAILLIST   fi   else @@ -231,5 +267,5 @@   echo " /bin/mail -s \"YUM:$HOSTNAME:$TODAY\" $MAILLIST "   fi - /bin/mail -s "YUM:$HOSTNAME:$TODAY" $MAILLIST < $TEMPMAILFILE + cat $TEMPPRERUNFILE $TEMPMAILFILE $TEMPPOSTRUNFILE | /bin/mail -s "YUM:$HOSTNAME:$TODAY" $MAILLIST   fi   fi @@ -244,5 +280,7 @@   yum -e 0 -d 0 clean packages   yum -e 0 -d 0 provides xyz > /dev/null 2>&1 + rm -f $TEMPPRERUNFILE   rm -f $TEMPMAILFILE + rm -f $TEMPPOSTRUNFILE   rm -f $TEMPCONFIGFILE   rm -f $TEMPRANDFILE diff -rU2 yum-autoupdate-2/etc/sysconfig/yum-autoupdate yum-autoupdate-2.new/etc/sysconfig/yum-autoupdate --- yum-autoupdate-2/etc/sysconfig/yum-autoupdate 2011-08-15 07:55:49.000000000 -0700 +++ yum-autoupdate-2.new/etc/sysconfig/yum-autoupdate 2011-10-26 15:13:39.262214560 -0700 @@ -45,2 +45,9 @@  DEBUG="false"   +# PRERUN +# The name of an executable or commands to run prior to updating (but after sleep) +PRERUN="" + +# POSTRUN +# The name of an executable or commands to run after updating (but before mailing) +POSTRUN=""

ATOM RSS1 RSS2