---
 yum-cron/yum-cron.sh        |   10 ++++++++++
 yum-cron/yum-cron.sysconfig |    4 ++++
 yum-cron/yum-update.cron.sh |   12 +++++++++++-
 3 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index e300fa7..c2af286 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -139,15 +139,25 @@ fi
           # code).
           /usr/bin/yum $YUM_PARAMETER -e 0 -d 0 check-update 2>&-
           case $? in
+            0)   #Record check
+                 date +%j | sed -e 's/^00*//' > /var/cache/yum/yum.cron;;
             1)   exit 1;;
             100) /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d 
${DEBUG_LEVEL:-0} -y update yum
                  /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d 
${DEBUG_LEVEL:-0} -y shell $YUMSCRIPT
+                 #Record day of run if successful
+                 if [ $? -eq 0 ]; then
+                   date +%j | sed -e 's/^00*//' > /var/cache/yum/yum.cron
+                 fi
                  ;;
           esac
         else
           # and here's the "just do it".
           /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d 
${DEBUG_LEVEL:-0} -y update yum
           /usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d 
${DEBUG_LEVEL:-0} -y shell $YUMSCRIPT
+          #Record day of run if successful
+          if [ $? -eq 0 ]; then
+            date +%j | sed -e 's/^00*//' > /var/cache/yum/yum.cron
+          fi
         fi
         ;;
     *)
diff --git a/yum-cron/yum-cron.sysconfig b/yum-cron/yum-cron.sysconfig
index 4c8c40d..ef134c5 100644
--- a/yum-cron/yum-cron.sysconfig
+++ b/yum-cron/yum-cron.sysconfig
@@ -72,6 +72,10 @@ RANDOMWAIT=60
 # day.
 #DAYS_OF_WEEK="0123456" 
 
+# You may set MAKEUP_MISSED to yes to enable making up missed or failed
+# runs from the DAYS_OF_WEEK listed above
+MAKEUP_MISSED=no
+
 # The cleanup task (which clears the package cache) can run on a subset
 # of the days above. (If the value chosen here doesn't appear in
 # DAYS_OF_WEEK, the cleanup task will never happen.)
diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
index b9edddf..92a038f 100755
--- a/yum-cron/yum-update.cron.sh
+++ b/yum-cron/yum-update.cron.sh
@@ -17,7 +17,17 @@ fi
 dow=`date +%w` 
 DAYS_OF_WEEK=${DAYS_OF_WEEK:-0123456} 
 if [[ "${DAYS_OF_WEEK/$dow/}" == "${DAYS_OF_WEEK}" ]]; then 
-  exit 0 
+  if [ "${MAKEUP_MISSED}" == yes ]; then
+    # Make sure we run once a week, and run the first time
+    if [ -f /var/cache/yum/yum.cron ]; then
+      lastday=`cat /var/cache/yum/yum.cron`
+      today=`date +%j | sed -e 's/^00*//'`
+      [ $today -lt $lastday ] && let today+=365
+      [ $((today-lastday)) -le 7 ] && exit 0
+    fi
+  else
+    exit 0
+  fi
 fi 
 
 # Wait a random number of minutes, again based on
-- 
1.7.7.6

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to