Blob Blame History Raw
diff -uNr fetch-crl-2.8.1.ORIG/edg-fetch-crl fetch-crl-2.8.1/edg-fetch-crl
--- fetch-crl-2.8.1.ORIG/edg-fetch-crl	2010-02-08 09:52:21.000000000 +0100
+++ fetch-crl-2.8.1/edg-fetch-crl	2010-02-11 22:59:59.182371636 +0100
@@ -19,6 +19,7 @@
 #              edg-fetch-crl [-l|--loc locationDirectory]                     #
 #                            [-o|--out outputDirectory] [-q|--quiet]          #
 #                            [-a|--agingtolerance hours ]                     #
+#                            [-r|--randomwait #minutes ]                      #
 #                                                                             #
 # Author:      Fabio Hernandez                                                #
 #              fabio@in2p3.fr                                                 #
@@ -40,6 +41,7 @@
 #              Jan 2009 - DG - new error codes (1=download error, 2=setup err #
 #                         drop text in output, DEFAULTPATH support, &c.       #
 #              Sep 2009 - DG/ST - new packaging and init scripts              #
+#              Feb 2010 - ST - Add --randomwait #minutes option.
 #                                                                             #
 ###############################################################################
 
@@ -270,6 +272,10 @@
    echo "                Also log messages and errors to syslog facility <fac>"
    echo "                Messages are logged at level DEBUG, errors at level ERR."
    echo
+   echo "      -r|--randomwait #minutes"
+   echo "                Specifies maximum time in minutes the command will sleep"
+   echo "                for before executing. Allows execution start to randomized"
+   echo
    echo "   Defaults can be set in the fetch-crl system configuration file"
    echo "   $FETCH_CRL_SYSCONFIG (resettable via the FETCH_CRL_SYSCONFIG environment"
    echo "   variable, see manual for details)."
@@ -536,7 +542,7 @@
 #
 # Parse the command line
 #
-getoptResult=`${getopt} -o hl:o:qva:nf -a -l help,loc:,out:,quiet,verbose,agingtolerance,no-check-certificate,syslog-facility,check-server-certificate -n ${programName} -- "$@"`
+getoptResult=`${getopt} -o hl:o:qva:nfr: -a -l help,loc:,out:,quiet,verbose,agingtolerance,no-check-certificate,syslog-facility,check-server-certificate,randomwait -n ${programName} -- "$@"`
 if [ $? != 0 ] ; then
    ShowUsage
    exit 2
@@ -554,6 +560,7 @@
       -q|--quiet) verboseMode=0; shift ;;
       -v|--verbose) verboseMode=1; shift ;;
       -a|--agingtolerance) cRLAgingThreshold="$2"; shift 2 ;;
+      -r|--randomwait) RandomWait="$2"; shift 2 ;;
       --)         shift; break;;
       *)          echo ${programName}": internal error!" ; exit 2 ;;
    esac
@@ -576,6 +583,20 @@
    exit 0
 fi
 
+#
+# Sleep for a random wait within a maximum if requested.
+#
+if [ "X${RandomWait}" != "X" ] ; then
+   timeStamp=`${date} +%Y%m%dT%H%M%S%z`
+   PrintInformation "Sleeping CRL retrieval process at ${timeStamp} for up to ${RandomWait} minutes"
+   sleep `expr ${RANDOM} % ${RandomWait}`m
+   if [ $? != 0 ] ; then
+     PrintError "Sleep of up to ${RandomWait} minutes failed..."
+     exit 2
+   fi
+fi
+
+
 # give hint to syslog that we started, if syslog is enabled
 
 timeStamp=`${date} +%Y%m%dT%H%M%S%z`
diff -uNr fetch-crl-2.8.1.ORIG/fetch-crl-cron.cron fetch-crl-2.8.1/fetch-crl-cron.cron
--- fetch-crl-2.8.1.ORIG/fetch-crl-cron.cron	2010-02-08 09:52:21.000000000 +0100
+++ fetch-crl-2.8.1/fetch-crl-cron.cron	2010-02-11 22:53:45.012352529 +0100
@@ -6,5 +6,5 @@
 # Note the lock file not existing is success hence the the slightly odd logic
 # below.
 
-22 */6 * * *	root	[ ! -f /var/lock/subsys/fetch-crl-cron ] || /usr/sbin/fetch-crl  -a 24 --quiet
+22 */6 * * *	root	[ ! -f /var/lock/subsys/fetch-crl-cron ] || /usr/sbin/fetch-crl -r 20  -a 24 --quiet