subDesTagesMitExtraKaese 3 месяцев назад
Родитель
Сommit
7d45bc1c42
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      run_backup.sh

+ 8 - 1
run_backup.sh

@@ -30,9 +30,16 @@ else
 fi
 
 # Prune old backups using a custom SSH port
-sudo -E borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=6 "$SERVER_USER@$SERVER_IP:$REPOSITORY"
+sudo -E borg prune --glob-archives '{hostname}-*' --keep-daily=7 --keep-weekly=4 --keep-monthly=6 --keep-yearly=10 "$SERVER_USER@$SERVER_IP:$REPOSITORY"
 
 if [ $? -ne 0 ]; then
     echo "Borg prune failed."
     exit 1
+fi
+
+sudo -E borg compact "$SERVER_USER@$SERVER_IP:$REPOSITORY"
+
+if [ $? -ne 0 ]; then
+    echo "Borg compact failed."
+    exit 1
 fi