mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-23 22:18:10 +01:00
#44 Remove 'invalid date' error message when performing backup-now
This commit is contained in:
@@ -394,21 +394,23 @@ move_backup() {
|
|||||||
print_debug "Backup routines Initialized on $(date)"
|
print_debug "Backup routines Initialized on $(date)"
|
||||||
|
|
||||||
### Wait for Next time to start backup
|
### Wait for Next time to start backup
|
||||||
current_time=$(date +"%s")
|
if [ "$1" != "NOW" ]; then
|
||||||
today=$(date +"%Y%m%d")
|
current_time=$(date +"%s")
|
||||||
|
today=$(date +"%Y%m%d")
|
||||||
|
|
||||||
if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then
|
if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then
|
||||||
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
|
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
|
||||||
else
|
else
|
||||||
target_time=$(date --date="${today}${DB_DUMP_BEGIN}" +"%s")
|
target_time=$(date --date="${today}${DB_DUMP_BEGIN}" +"%s")
|
||||||
if [[ "$target_time" < "$current_time" ]]; then
|
if [[ "$target_time" < "$current_time" ]]; then
|
||||||
target_time=$(($target_time + 24*60*60))
|
target_time=$(($target_time + 24*60*60))
|
||||||
|
fi
|
||||||
|
waittime=$(($target_time - $current_time))
|
||||||
fi
|
fi
|
||||||
waittime=$(($target_time - $current_time))
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_notice "Next Backup at $(date -d @${target_time} +"%Y-%m-%d %T %Z")"
|
print_notice "Next Backup at $(date -d @${target_time} +"%Y-%m-%d %T %Z")"
|
||||||
sleep $waittime
|
sleep $waittime
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
### Commence Backup
|
### Commence Backup
|
||||||
|
|||||||
Reference in New Issue
Block a user