From 6b61177fa10143cd27e01f4033364255c2ce26d0 Mon Sep 17 00:00:00 2001 From: "Dejan R." Date: Thu, 27 Nov 2025 16:28:26 +0000 Subject: [PATCH] added filter for deleting backup after 5 last backup --- scripts/backup-netbird.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/backup-netbird.sh b/scripts/backup-netbird.sh index 7215e7f..bb99fdb 100755 --- a/scripts/backup-netbird.sh +++ b/scripts/backup-netbird.sh @@ -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"