Plan borg: updates (step).

This commit is contained in:
Christian P. MOMON 2023-01-23 01:24:16 +01:00
parent f799421d24
commit 6e006c02f1
1 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,7 @@ BORG_REPOS="/var/backups/borg/"
cd $BORG_REPOS cd $BORG_REPOS
ARCHIVE_COUNT=0 ARCHIVE_COUNT=0
REPO_COUNT=0 REPO_COUNT=0
echo "COMPUTER COUNT LAST Original size Compressed size Deduplicated size Duration" echo "COMPUTER COUNT LAST Diff Original Compressed Dedup Duration"
for BORG_REPO in $(ls -d *.repo); do for BORG_REPO in $(ls -d *.repo); do
if [ -d "$BORG_REPO" ]; then if [ -d "$BORG_REPO" ]; then
#echo "== $BORG_REPO" #echo "== $BORG_REPO"
@ -19,12 +19,17 @@ for BORG_REPO in $(ls -d *.repo); do
COUNT=$(echo "$LIST" | wc -l) COUNT=$(echo "$LIST" | wc -l)
LAST=$(echo "$LIST" | sort -h | tail -1 | awk '{ print $1}' ) LAST=$(echo "$LIST" | sort -h | tail -1 | awk '{ print $1}' )
SIZE_LINE=$(borg info "$BORG_REPO" | head -8 | tail -1) SIZE_LINE=$(borg info "$BORG_REPO" | head -8 | tail -1)
ORIGINAL_SIZE=$(echo "$SIZE_LINE" | awk '{ print $3" "$4 }')
COMPRESSED_SIZE=$(echo "$SIZE_LINE" | awk '{ print $5" "$6 }')
DEDUP_SIZE=$(echo "$SIZE_LINE" | awk '{ print $7" "$8 }')
SIZES="${SIZE_LINE:13}" SIZES="${SIZE_LINE:13}"
DURATION=$(borg info "${BORG_REPO}::${LAST}" | grep Duration) INFOS=$(borg info "${BORG_REPO}::${LAST}")
DURATION=$(echo "$INFOS" | grep Duration)
DURATION=${DURATION:10} DURATION=${DURATION:10}
DURATION=${DURATION/ minutes / min } DURATION=${DURATION/ minutes / min }
DURATION=${DURATION/ seconds/ s} DURATION=${DURATION/ seconds/ s}
printf "%-40s %2d %s %s %s\n" "$COMPUTER" "$COUNT" "$LAST" "$SIZES" "$DURATION" DIFF_SIZE=$(echo "$INFOS" | grep "This archive" | awk '{ print $7" "$8}')
printf "%-40s %2d %s %12s %12s %12s %12s %s\n" "$COMPUTER" "$COUNT" "$LAST" "$DIFF_SIZE" "$ORIGINAL_SIZE" "$COMPRESSED_SIZE" "$DEDUP_SIZE" "$DURATION"
ARCHIVE_COUNT=$((ARCHIVE_COUNT+COUNT)) ARCHIVE_COUNT=$((ARCHIVE_COUNT+COUNT))
fi fi