2023-01-20 01:12:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SCRIPT_NAME="$(basename "$0")"
|
|
|
|
|
2023-01-22 01:01:35 +01:00
|
|
|
export BORG_PASSCOMMAND="cat /srv/borg/.borg-passphrase"
|
|
|
|
|
2023-01-20 01:12:23 +01:00
|
|
|
BORG_REPOS="/var/backups/borg/"
|
|
|
|
cd $BORG_REPOS
|
2023-01-21 16:25:50 +01:00
|
|
|
ARCHIVE_COUNT=0
|
|
|
|
REPO_COUNT=0
|
2023-01-23 01:24:16 +01:00
|
|
|
echo "COMPUTER COUNT LAST Diff Original Compressed Dedup Duration"
|
2023-01-20 01:12:23 +01:00
|
|
|
for BORG_REPO in $(ls -d *.repo); do
|
|
|
|
if [ -d "$BORG_REPO" ]; then
|
|
|
|
#echo "== $BORG_REPO"
|
2023-01-21 16:25:50 +01:00
|
|
|
REPO_COUNT=$(( REPO_COUNT +1))
|
|
|
|
|
2023-01-20 01:12:23 +01:00
|
|
|
COMPUTER=$(printf "%-40s" ${BORG_REPO::-5})
|
|
|
|
LIST=$(borg list "$BORG_REPO")
|
|
|
|
COUNT=$(echo "$LIST" | wc -l)
|
|
|
|
LAST=$(echo "$LIST" | sort -h | tail -1 | awk '{ print $1}' )
|
|
|
|
SIZE_LINE=$(borg info "$BORG_REPO" | head -8 | tail -1)
|
2023-01-23 01:24:16 +01:00
|
|
|
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 }')
|
2023-01-20 01:12:23 +01:00
|
|
|
SIZES="${SIZE_LINE:13}"
|
2023-01-23 01:24:16 +01:00
|
|
|
INFOS=$(borg info "${BORG_REPO}::${LAST}")
|
|
|
|
DURATION=$(echo "$INFOS" | grep Duration)
|
2023-01-21 16:25:50 +01:00
|
|
|
DURATION=${DURATION:10}
|
2023-01-21 16:31:10 +01:00
|
|
|
DURATION=${DURATION/ minutes / min }
|
|
|
|
DURATION=${DURATION/ seconds/ s}
|
2023-01-23 01:24:16 +01:00
|
|
|
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"
|
2023-01-20 01:12:23 +01:00
|
|
|
|
2023-01-21 16:25:50 +01:00
|
|
|
ARCHIVE_COUNT=$((ARCHIVE_COUNT+COUNT))
|
2023-01-20 01:12:23 +01:00
|
|
|
fi
|
|
|
|
done
|
2023-01-21 16:25:50 +01:00
|
|
|
echo "Total repository count: "$REPO_COUNT
|
|
|
|
echo "Total archive count: "$ARCHIVE_COUNT
|
|
|
|
echo "Total disk size: "$(du -sh .)
|
2023-01-21 12:56:24 +01:00
|
|
|
df -h /var/backups/borg/.
|