diff options
-rwxr-xr-x | backup.sh | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -137,8 +137,13 @@ backup_borg() { fi borg create "${options[@]}" "$dst::$backup_prefix-$(date "+%Y%m%d-%H%M%S")" "${src[@]}" - borg prune --prefix "backup-" --keep-within 7d --keep-daily 7 --keep-weekly 12 --keep-monthly 6 --keep-yearly 0 -v "$dst" - borg prune --prefix "partial-" --keep-within 7d --keep-daily 7 --keep-weekly 12 --keep-monthly 6 --keep-yearly 0 -v "$dst" + + # Only purge when doing full backups. Increases partial backup speed and + # ensure that we have at least one recent full backup when we purge. + if [[ $backup_prefix == 'backup-' ]]; then + borg prune --prefix "backup-" --keep-within 7d --keep-daily 7 --keep-weekly 12 --keep-monthly 6 --keep-yearly 0 -v "$dst" + borg prune --prefix "partial-" --keep-within 7d --keep-daily 7 --keep-weekly 12 --keep-monthly 6 --keep-yearly 0 -v "$dst" + fi } ### support functions below ### |