aboutsummaryrefslogtreecommitdiffstats
path: root/debian/sitesummary-client.cron.daily
diff options
context:
space:
mode:
Diffstat (limited to 'debian/sitesummary-client.cron.daily')
-rw-r--r--debian/sitesummary-client.cron.daily32
1 files changed, 31 insertions, 1 deletions
diff --git a/debian/sitesummary-client.cron.daily b/debian/sitesummary-client.cron.daily
index 9852f8b..5a94bed 100644
--- a/debian/sitesummary-client.cron.daily
+++ b/debian/sitesummary-client.cron.daily
@@ -2,5 +2,35 @@
#
# Author: Petter Reinholdtsen
+[ -x /usr/sbin/sitesummary-client ] || exit 0
+
+# Read the package default. Make sure this is identical to the code
+# in sitesummar-client
+[ -f /usr/share/sitesummary/sitesummary-client.conf ] && \
+ . /usr/share/sitesummary/sitesummary-client.conf
+for confdir in \
+ /usr/share/sitesummary/config.d \
+ /etc/sitesummary/config.d
+do
+ [ -d $confdir ] || continue
+ for config in $confdir/* ; do
+ [ -f $config ] && . $config
+ 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
+
# Run once a day to report the whereabouts of the machine
-[ -x /usr/sbin/sitesummary-client ] && nice /usr/sbin/sitesummary-client
+nice /usr/sbin/sitesummary-client