aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-client
diff options
context:
space:
mode:
Diffstat (limited to 'sitesummary-client')
-rw-r--r--sitesummary-client15
1 files changed, 15 insertions, 0 deletions
diff --git a/sitesummary-client b/sitesummary-client
index 9e53e1f..44e416b 100644
--- a/sitesummary-client
+++ b/sitesummary-client
@@ -53,6 +53,21 @@ do
done
done
+# Sleep a random number of seconds to avoid all clients connecting to
+# the server at the same time. Based on code from the cron-apt
+# package.
+if [ -n "$runsleep" ] ; then
+ if [ $runsleep -gt 0 ] ; then
+ if [ -z "$RANDOM" ] ; then
+ # A fix for shells that do not have this bash feature.
+ RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5")
+ fi
+ TIME=$(($RANDOM % $runsleep))
+ sleep $TIME
+ fi
+fi
+
+
mkdir $tmpdir && cd $tmpdir
for fragdir in $fragdirs ; do