compact eingefügt, wenn v>1.1

This commit is contained in:
2025-05-30 20:00:43 +02:00
parent 9f9a88540f
commit 030791a8a8

View File

@@ -183,10 +183,18 @@ borg_info() {
# Anzahl der Sicherungen wird in $BORG_PRUNING festgelegt
borg_prune() {
echo "Bereinige das Backup-Repository..."
$BORG prune -v --list $BORG_PRUNING "$BORG_REPO"
echo "Compactiere das Backup-Repository..."
# Borg compact command is used to reduce the size of the repository by removing unused data.
$BORG compact "$BORG_REPO"
$BORG prune -v --list $BORG_PRUNING "$BORG_REPO"
BORG_VERSION=$($BORG -V 2>/dev/null | grep -oE '[0-9]+\.[0-9]+')
MAJOR=$(echo $BORG_VERSION | cut -d. -f1)
MINOR=$(echo $BORG_VERSION | cut -d. -f2)
if [ "$MAJOR" -gt 1 ] || ([ "$MAJOR" -eq 1 ] && [ "$MINOR" -ge 2 ]); then
echo "Borg $BORG_VERSION: führe compact aus"
$BORG compact "$BORG_REPO"
else
echo "Borg $BORG_VERSION: compact nicht unterstützt, da älter als 1.2"
fi
}
# auflisten von Borg-Sicherungen