summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-12-21 18:56:58 +0100
committerSimon Rettberg2015-12-21 18:56:58 +0100
commita276a80584a045a304029cc443fc8ef30ae57afb (patch)
tree34a4c1bbdac500a14a6a78fcbee080a9de61e66c
parent[kernel-vanilla] bump to 4.3.3 (diff)
downloadtm-scripts-a276a80584a045a304029cc443fc8ef30ae57afb.tar.gz
tm-scripts-a276a80584a045a304029cc443fc8ef30ae57afb.tar.xz
tm-scripts-a276a80584a045a304029cc443fc8ef30ae57afb.zip
[hardware-stats] Randomize reporting interval offset on boot
-rw-r--r--remote/modules/hardware-stats/data/etc/cron.d/usage_stats7
-rwxr-xr-xremote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats9
2 files changed, 9 insertions, 7 deletions
diff --git a/remote/modules/hardware-stats/data/etc/cron.d/usage_stats b/remote/modules/hardware-stats/data/etc/cron.d/usage_stats
deleted file mode 100644
index 282ee63e..00000000
--- a/remote/modules/hardware-stats/data/etc/cron.d/usage_stats
+++ /dev/null
@@ -1,7 +0,0 @@
-# Update usage statistics on server
-
-SHELL=/bin/sh
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin
-
-*/5 * * * * root /opt/openslx/scripts/cron-system_usage_update
-
diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
index 6a3829e5..81db23a4 100755
--- a/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
+++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats
@@ -178,6 +178,15 @@ for DELAY in 1 1 0; do
--data-urlencode "data@$DATAFILE" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then
rm -f -- "$DATAFILE"
echo "$UUID" > "/run/system-uuid"
+ START=$(( $RANDOM % 5 ))
+ cat > "/etc/cron.d/usage_stats" <<-EOF
+ # Update usage statistics on server
+
+ SHELL=/bin/sh
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin
+
+ ${START}-59/5 * * * * root /opt/openslx/scripts/cron-system_usage_update
+ EOF
exit 0
fi
sleep "$DELAY"