compact eingefügt, wenn v>1.1

This commit is contained in:
2025-05-30 20:00:23 +02:00
parent 3e569814a3
commit 9f9a88540f

View File

@@ -94,6 +94,7 @@ EOF
}
die() { echo "$*" 1>&2 ; exit 1; }
## neues Backup erzeugen
@@ -136,6 +137,7 @@ Aufruf $0
keyexport - exportiert Repokey in lokale Datei
EOF
}
#Repokey zusätzlich lokal speichern
@@ -148,7 +150,7 @@ borg_keyexport() {
# überprüfen, ob borg-Repository initialisiert wurde
# und ausführen, falls nötig
borg_check() {
echo "Überprüfe, ob das Repository initialisiert ist..."
echo "Überprüfe, ob das Repository initialisiert ist..."
if $BORG check ${BORG_REPO}; then
echo "Das Repository ist bereits initialisiert."
return 0
@@ -181,10 +183,16 @@ 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"
fi
}
# auflisten von Borg-Sicherungen