Oracle DR: Fix backup retention to keep exactly 2 days instead of 3

Changed -mtime logic from +$RetentionDays to +($RetentionDays - 1) to correctly implement 2-day retention. Previously kept 3 days (today + 2 previous), now keeps exactly 2 days (today + yesterday).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Marius
2025-10-15 22:54:02 +03:00
parent b50cc2b8c4
commit 8bb494c60e
2 changed files with 6 additions and 2 deletions

View File

@@ -59,7 +59,9 @@ function Cleanup-OldBackupsOnDR {
Write-Log "Backups before cleanup: $countBefore"
# Cleanup: șterge fișiere mai vechi de $RetentionDays zile
$cleanupCmd = "find '$DRPath' -name '*.BKP' -type f -mtime +$RetentionDays -delete 2>&1"
# -mtime +N înseamnă "mai vechi de N zile", deci pentru a păstra RetentionDays zile, folosim +($RetentionDays - 1)
$mtimeDays = $RetentionDays - 1
$cleanupCmd = "find '$DRPath' -name '*.BKP' -type f -mtime +$mtimeDays -delete 2>&1"
$result = & ssh -n -p $DRPort -i $SSHKeyPath "${DRUser}@${DRHost}" $cleanupCmd 2>&1
if ($LASTEXITCODE -ne 0) {