mirror of
https://github.com/laurent22/rsync-time-backup
synced 2024-12-15 06:32:30 +00:00
More robust date handling.
Previously the date handling expiry logic had a bug where if you had backups that were a year apart to the day, it wouldn't notice the difference in year and only notice that the month was the same, and expire the older one (eg, if you had a backup on 2012-04-01 and another on 2013-04-01, it'd delete the one from 2012. This commit makes it compare the full date string instead of just the month, so that it more robustly keeps older backups.
This commit is contained in:
parent
ae7998025a
commit
9b9a564447
1 changed files with 2 additions and 2 deletions
|
@ -190,11 +190,11 @@ while [ "1" ]; do
|
||||||
|
|
||||||
elif [ $stamp -ge $KEEP_DAILIES_DATE ]; then
|
elif [ $stamp -ge $KEEP_DAILIES_DATE ]; then
|
||||||
# Delete all but the most recent of each day.
|
# Delete all but the most recent of each day.
|
||||||
[ ${date:8:2} -eq ${prev:8:2} ] && fn_expire_backup "$fname"
|
[ "${date:0:10}" == "${prev:0:10}" ] && fn_expire_backup "$fname"
|
||||||
|
|
||||||
else
|
else
|
||||||
# Delete all but the most recent of each month.
|
# Delete all but the most recent of each month.
|
||||||
[ ${date:5:2} -eq ${prev:5:2} ] && fn_expire_backup "$fname"
|
[ "${date:0:7}" == "${prev:0:7}" ] && fn_expire_backup "$fname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prev=$date
|
prev=$date
|
||||||
|
|
Loading…
Reference in a new issue