Skip to content

Commit 6a28ac2

Browse files
committed
Fix code for absolute time
1 parent 06cfba4 commit 6a28ac2

File tree

1 file changed

+6
-2
lines changed
  • install/etc/services.available/10-db-backup

1 file changed

+6
-2
lines changed

install/etc/services.available/10-db-backup/run

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ else
2525
target_time=$(($current_time + $waittime))
2626
elif [[ $DB_DUMP_BEGIN =~ ^[0-9]+$ ]]; then
2727
print_debug "DB_DUMP_BEGIN is an integer."
28-
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
29-
target_time=$(($current_time + $waittime))
28+
29+
target_time=$(date --date="${today}${DB_DUMP_BEGIN}" +"%s")
30+
if [[ "$target_time" < "$current_time" ]]; then
31+
target_time=$(($target_time + 24*60*60))
32+
fi
33+
waittime=$(($target_time - $current_time))
3034
elif [[ $DB_DUMP_BEGIN =~ ^([0-9]{4})-([0-9]{2})-([0-9]{2})[[:space:]]([0-9]{2}):([0-9]{2}):([0-9]{2})$ ]];
3135
then
3236
# Extract year, month, day, hours, minutes, and seconds from DB_DUMP_BEGIN

0 commit comments

Comments
 (0)