File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1- 2.3.20
1+ 2.3.21
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments