mirror of
https://github.com/bitwarden/server.git
synced 2024-12-24 17:17:40 +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
|
||||
BACKUP_INTERVAL=${BACKUP_INTERVAL:-next day}
|
||||
BACKUP_INTERVAL_FORMAT=${BACKUP_INTERVAL_FORMAT:-%Y-%m-%d 00:00:00}
|
||||
|
||||
while true
|
||||
do
|
||||
# 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
|
||||
export now=$(date +%Y%m%d_%H%M%S)
|
||||
|
Loading…
Reference in New Issue
Block a user