diff options
author | Florian Pritz <bluewind@xinu.at> | 2020-01-27 16:53:28 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2020-01-27 16:53:28 +0100 |
commit | b8c14b1740ac268eb6b4ff56c856ddba1ccfdc2b (patch) | |
tree | 44a327ed311e36aba10cdbd5ca50e8e7113cf747 | |
parent | 51eef1e9d1013186b67f584ba1014add588439e4 (diff) | |
download | bin-b8c14b1740ac268eb6b4ff56c856ddba1ccfdc2b.tar.gz bin-b8c14b1740ac268eb6b4ff56c856ddba1ccfdc2b.tar.xz |
backup.sh: Only purge when doing full backups
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-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 ### |