subDesTagesMitExtraKaese 3 сар өмнө
parent
commit
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