Add a deterministic sleep to spread out the load and lets run it at night in test

This commit is contained in:
Micke Nordin 2025-02-26 12:08:03 +01:00
parent 2c974bd178
commit 1654186ddc
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
3 changed files with 5 additions and 2 deletions

View file

@ -114,7 +114,7 @@ define sunetdrive::app_type (
command => '/usr/local/bin/scan_external_mounts',
user => 'root',
minute => '20',
hour => '10',
hour => '1',
}
}
file { '/opt/nextcloud/cron.sh':

View file

@ -59,7 +59,7 @@ class sunetdrive::multinode (
command => '/usr/local/bin/scan_external_mounts',
user => 'root',
minute => '20',
hour => '10',
hour => '1',
}
}
file { '/usr/local/bin/nocc':

View file

@ -1,4 +1,7 @@
#!/bin/bash
# We sleep a deterministic amount of time, which will be between 0 an 128 m and allways the same within
# a specific host, but will differ between hosts
sleep $((16#$(ip a | grep "link/ether" | head -1 | awk -F ':' '{print $6}' | awk '{print $1}') / 2))m
# Only run if this is the only instance of this script running
# note: since this script forks to run pgrep, we need -eq 2 here