From 8c71fd192fbeb9f72ffa0e5e146d75f85ad800dc Mon Sep 17 00:00:00 2001 From: clonejo Date: Sun, 3 May 2020 16:34:42 +0200 Subject: [PATCH] Run nightly tasks on a random minute after 03:00 to avoid overload - The MIAB version check regularly fails at 03:00, presumably because a large portion of installations is checking mailinabox.email at the same time. - At installation time, the time of the nightly clock is configured to run at a random minute after 03:00, but before 04:00. - Users might expect the nightly tasks to be over at a certain time and run their own custom tasks afterwards. This could thus interfere with custom backup routines. - This breaks reproducibility of the installation process. - Users might also be surprised by the nightly task time changing after updatign MIAB. --- setup/management.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup/management.sh b/setup/management.sh index 3caf8eea..9d7c762c 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -101,10 +101,11 @@ hide_output systemctl enable mailinabox.service # Perform nightly tasks at 3am in system time: take a backup, run # status checks and email the administrator any changes. +minute=$((RANDOM % 60)) # avoid overloading mailinabox.email cat > /etc/cron.d/mailinabox-nightly << EOF; # Mail-in-a-Box --- Do not edit / will be overwritten on update. # Run nightly tasks: backup, status checks. -0 3 * * * root (cd `pwd` && management/daily_tasks.sh) +$minute 3 * * * root (cd `pwd` && management/daily_tasks.sh) EOF # Start the management server.