add the ability to set a pruning policy

defaulted to --max-unused 1% in configuration.
This commit is contained in:
Kevin Woley
2021-02-24 21:02:41 -08:00
parent a840f5ae04
commit 01a38f893a
2 changed files with 2 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ function Invoke-Maintenance {
# prune (remove) data from the backup step. Running this separate from `forget` because
# `forget` only prunes when it detects removed snapshots upon invocation, not previously removed
Write-Output "[[Maintenance]] Start pruning..." | Tee-Object -Append $SuccessLog
& $ResticExe prune 3>&1 2>> $ErrorLog | Tee-Object -Append $SuccessLog
& $ResticExe prune $SnapshotPrunePolicy 3>&1 2>> $ErrorLog | Tee-Object -Append $SuccessLog
if(-not $?) {
Write-Output "[[Maintenance]] Prune operation completed with errors" | Tee-Object -Append $ErrorLog | Tee-Object -Append $SuccessLog
$maintenance_success = $false

View File

@@ -13,6 +13,7 @@ $GlobalRetryAttempts = 4
# maintenance configuration
$SnapshotMaintenanceEnabled = $true
$SnapshotRetentionPolicy = @("--group-by", "host", "--keep-daily", "30", "--keep-weekly", "52", "--keep-monthly", "24", "--keep-yearly", "10")
$SnapshotPrunePolicy = @("--max-unused", "1%")
$SnapshotMaintenanceInterval = 7
$SnapshotMaintenanceDays = 30
$SnapshotDeepMaintenanceDays = 90;