added filter for deleting backup after 5 last backup
This commit is contained in:
parent
15b61c2194
commit
6b61177fa1
|
|
@ -89,11 +89,11 @@ else
|
|||
fi
|
||||
|
||||
# Optional: Keep only last N backups (uncomment to enable)
|
||||
# KEEP_BACKUPS=5
|
||||
# print_msg "Cleaning old backups, keeping last $KEEP_BACKUPS..."
|
||||
# cd "$BACKUP_DIR"
|
||||
# ls -t netbird-backup-*.tar.gz | tail -n +$((KEEP_BACKUPS + 1)) | xargs -r rm
|
||||
# print_msg "Old backups cleaned"
|
||||
KEEP_BACKUPS=5
|
||||
print_msg "Cleaning old backups, keeping last $KEEP_BACKUPS..."
|
||||
cd "$BACKUP_DIR"
|
||||
ls -t netbird-backup-*.tar.gz | tail -n +$((KEEP_BACKUPS + 1)) | xargs -r rm
|
||||
print_msg "Old backups cleaned"
|
||||
|
||||
print_msg "Backup process completed successfully!"
|
||||
print_msg "Backup location: $BACKUP_PATH"
|
||||
|
|
|
|||
Loading…
Reference in a new issue