Skip to content

Commit 4c5abac

Browse files
authored
v2.3.21 (#84)
Minor updates * Use randomiser to run backup at different minutes past the hour
1 parent 5a9b31d commit 4c5abac

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.20
1+
2.3.21

overlay/etc/bf/init.d/13-cron

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/command/with-contenv sh
2+
3+
set -euo pipefail
4+
export BF_E=`basename ${0}`
5+
6+
7+
#======================================================================================================================
8+
# Generate crontab and append backup task - set the minutes to a random number so multiple containers on one host don't
9+
# all try to backup at the same time.
10+
#======================================================================================================================
11+
12+
bf-echo "Generating crontab..."
13+
CRONTAB=/etc/crontabs/root
14+
bf-esh \
15+
${BF_TEMPLATES}/crontab.esh \
16+
${CRONTAB}
17+
echo "$((1 + ${RANDOM} % 59)) */8 * * * db-backup" >> /etc/crontabs/root >> ${CRONTAB}
18+
bf-done

overlay/tmp/install

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ mkdir /run/postgresql
4646

4747

4848
#======================================================================================================================
49-
# Add backup executable to main cron.
49+
# Store default crontab as a template.
5050
#======================================================================================================================
5151

52-
bf-echo "Adding db-backup to cron."
53-
echo "0 */8 * * * /usr/bin/bf/db-backup" >> /etc/crontabs/root
52+
cp /etc/crontabs/root /etc/bf/templates/crontab.esh

0 commit comments

Comments
 (0)