summaryrefslogtreecommitdiffstats
path: root/remote/modules/hardware-stats/data/opt/openslx/scripts
diff options
context:
space:
mode:
authorSimon Rettberg2015-12-21 18:56:58 +0100
committerSimon Rettberg2015-12-21 18:56:58 +0100
commita276a80584a045a304029cc443fc8ef30ae57afb (patch)
tree34a4c1bbdac500a14a6a78fcbee080a9de61e66c /remote/modules/hardware-stats/data/opt/openslx/scripts
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
Diffstat (limited to 'remote/modules/hardware-stats/data/opt/openslx/scripts')
-rwxr-xr-xremote/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats9
1 files changed, 9 insertions, 0 deletions
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"