mirror of
https://github.com/bitwarden/server.git
synced 2024-11-28 13:15:12 +01:00
Allow for slight customization of the mssql db backup interval (#1008)
* Allow for slight customization of the mssql db backup interval * Honor env TZ if set and clean up -u in sleep calculation
This commit is contained in:
parent
25dff79527
commit
d63eb376c4
@ -1,9 +1,14 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
BACKUP_INTERVAL=${BACKUP_INTERVAL:-next day}
|
||||||
|
BACKUP_INTERVAL_FORMAT=${BACKUP_INTERVAL_FORMAT:-%Y-%m-%d 00:00:00}
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
# Sleep until next day
|
# Sleep until next day
|
||||||
[ "$1" = "loop" ] && sleep $((24 * 3600 - (`date +%_H` * 3600 + `date +%_M` * 60 + `date +%_S`)))
|
if [ "$1" = "loop" ]; then
|
||||||
|
interval_start=`date "+${BACKUP_INTERVAL_FORMAT} %z" -d "${BACKUP_INTERVAL}"`
|
||||||
|
sleep $((`date +%_s -d "${interval_start}"` - `date +%_s`))
|
||||||
|
fi
|
||||||
|
|
||||||
# Backup timestamp
|
# Backup timestamp
|
||||||
export now=$(date +%Y%m%d_%H%M%S)
|
export now=$(date +%Y%m%d_%H%M%S)
|
||||||
|
Loading…
Reference in New Issue
Block a user