From 6bdb773d7df3443b7cdf07197ba416180f5d809a Mon Sep 17 00:00:00 2001 From: bfren Date: Thu, 8 Jun 2023 09:37:09 +0100 Subject: [PATCH 1/2] Bumping version to 2.3.21 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6948441..cb7bf85 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.20 \ No newline at end of file +2.3.21 \ No newline at end of file From 5c6c28d47cd5c111368ee2845eff4ceea465458e Mon Sep 17 00:00:00 2001 From: bfren Date: Thu, 8 Jun 2023 09:37:27 +0100 Subject: [PATCH 2/2] Use randomiser to run backup at different minutes past the hour --- overlay/etc/bf/init.d/13-cron | 18 ++++++++++++++++++ overlay/tmp/install | 5 ++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 overlay/etc/bf/init.d/13-cron diff --git a/overlay/etc/bf/init.d/13-cron b/overlay/etc/bf/init.d/13-cron new file mode 100644 index 0000000..d69ef22 --- /dev/null +++ b/overlay/etc/bf/init.d/13-cron @@ -0,0 +1,18 @@ +#!/command/with-contenv sh + +set -euo pipefail +export BF_E=`basename ${0}` + + +#====================================================================================================================== +# Generate crontab and append backup task - set the minutes to a random number so multiple containers on one host don't +# all try to backup at the same time. +#====================================================================================================================== + +bf-echo "Generating crontab..." +CRONTAB=/etc/crontabs/root +bf-esh \ + ${BF_TEMPLATES}/crontab.esh \ + ${CRONTAB} +echo "$((1 + ${RANDOM} % 59)) */8 * * * db-backup" >> /etc/crontabs/root >> ${CRONTAB} +bf-done diff --git a/overlay/tmp/install b/overlay/tmp/install index 0689d3f..bb3ca96 100644 --- a/overlay/tmp/install +++ b/overlay/tmp/install @@ -46,8 +46,7 @@ mkdir /run/postgresql #====================================================================================================================== -# Add backup executable to main cron. +# Store default crontab as a template. #====================================================================================================================== -bf-echo "Adding db-backup to cron." -echo "0 */8 * * * /usr/bin/bf/db-backup" >> /etc/crontabs/root +cp /etc/crontabs/root /etc/bf/templates/crontab.esh