2023-01-16 19:44:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "================================================================================"
|
|
|
|
echo " Prunes du "$(date)
|
|
|
|
echo "================================================================================"
|
2023-01-20 00:45:52 +01:00
|
|
|
START_TIME=$(date +"%s")
|
2023-01-26 15:45:10 +01:00
|
|
|
START_SIZE=$(du -s /var/backups/borg/ | awk '{ print $1 }')
|
2023-01-16 19:44:21 +01:00
|
|
|
|
2023-03-21 16:42:01 +01:00
|
|
|
borgmatic prune --stats --list --verbosity 1
|
2023-02-08 13:08:40 +01:00
|
|
|
|
|
|
|
# Only last borgmatic version has the compact command.
|
|
|
|
cd /var/backups/borg/
|
|
|
|
for REPO in $( ls -d *.repo ); do
|
|
|
|
echo "Compact $REPO"
|
|
|
|
borg compact "$REPO"
|
|
|
|
done
|
2023-01-16 19:44:21 +01:00
|
|
|
|
2023-03-14 16:18:39 +01:00
|
|
|
chown -R borg.borg /var/backups/borg/*.repo
|
|
|
|
|
2023-02-09 15:02:14 +01:00
|
|
|
df -h /var/backups/borg/.
|
|
|
|
|
2023-01-16 19:44:21 +01:00
|
|
|
echo "====="
|
2023-01-20 00:45:52 +01:00
|
|
|
DURATION=$(($(date +"%s")-$START_TIME))
|
2023-01-26 15:45:10 +01:00
|
|
|
DURATION=$(printf "%02d:%02d:%02d" $((DURATION/60/60)) $((DURATION/60%60)) $((DURATION%60)))
|
|
|
|
END_SIZE=$(du -s /var/backups/borg/ | awk '{ print $1 }')
|
|
|
|
DIFF_SIZE=$(((END_SIZE-START_SIZE)/1024))
|
|
|
|
echo "Ended at: "$(date)" Duration: $DURATION Size: $DIFF_SIZE MB"
|
2023-01-16 19:44:21 +01:00
|
|
|
echo "================================================================================"
|