[Yum-devel] [PATCH 01/10] Better comments for the cron scripts.

Matthew Miller mattdm at mattdm.org
Fri Jul 29 01:59:46 UTC 2011


No code changes -- everything is behind a "#".
---
 yum-cron/yum-cleanup.cron.sh |   11 +++++++----
 yum-cron/yum-update.cron.sh  |   13 ++++++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/yum-cron/yum-cleanup.cron.sh b/yum-cron/yum-cleanup.cron.sh
index 0842135..e38e80f 100755
--- a/yum-cron/yum-cleanup.cron.sh
+++ b/yum-cron/yum-cleanup.cron.sh
@@ -1,23 +1,26 @@
 #!/bin/bash
 
-# Only run if this flag file is set (by /etc/rc.d/init.d/yum-cron)
+# Only run if this flag is set. The flag is created by the yum-cron init
+# script when the service is started -- this allows one to use chkconfig and
+# the standard "service stop|start" commands to enable or disable yum-cron.
 if [[ ! -f /var/lock/subsys/yum-cron ]]; then
   exit 0
 fi
 
-# Grab config settings
+# Read configuration settings from the sysconfig directory.
 if [[ -f /etc/sysconfig/yum-cron ]]; then
   source /etc/sysconfig/yum-cron
 fi
 
-# Only run on certain days of the week 
+# Only run on certain days of the week, based on the
+# settings in the above-mentioned sysconfig file.
 dow=`date +%w` 
 DAYS_OF_WEEK=${DAYS_OF_WEEK:-0123456} 
 if [[ "${DAYS_OF_WEEK/$dow/}" == "${DAYS_OF_WEEK}" ]]; then 
   exit 0 
 fi 
 
-# And only _clean_ on a subset of that
+# And only _clean_ on a subset of the configured days.
 CLEANDAY=${CLEANDAY:-0}
 if [[ "${CLEANDAY/$dow/}" == "${CLEANDAY}" ]]; then
   exit 0
diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
index 1801a11..c439ad3 100755
--- a/yum-cron/yum-update.cron.sh
+++ b/yum-cron/yum-update.cron.sh
@@ -1,25 +1,28 @@
 #!/bin/bash
 
-# Only run if this flag file is set (by /etc/rc.d/init.d/yum-cron)
+# Only run if this flag is set. The flag is created by the yum-cron init
+# script when the service is started -- this allows one to use chkconfig and
+# the standard "service stop|start" commands to enable or disable yum-cron.
 if [[ ! -f /var/lock/subsys/yum-cron ]]; then
   exit 0
 fi
 
-# Grab config settings
+# Read configuration settings from the sysconfig directory.
 if [[ -f /etc/sysconfig/yum-cron ]]; then
   source /etc/sysconfig/yum-cron
 fi
 
-# Only run on certain days of the week 
+# Only run on certain days of the week, based on the
+# settings in the above-mentioned sysconfig file.
 dow=`date +%w` 
 DAYS_OF_WEEK=${DAYS_OF_WEEK:-0123456} 
 if [[ "${DAYS_OF_WEEK/$dow/}" == "${DAYS_OF_WEEK}" ]]; then 
   exit 0 
 fi 
 
-# Random wait
+# Wait a random number of minutes, again based on
+# the setting in the sysconfig file.
 [[ $RANDOMWAIT -gt 0 ]] && sleep $(( $RANDOM % ($RANDOMWAIT * 60) + 1 ))
 
 # Action!
 exec /usr/sbin/yum-cron update
-
-- 
1.7.6



More information about the Yum-devel mailing list