From 5be124c9fd86ea1c0209cad8b3d63b883f12a75b Mon Sep 17 00:00:00 2001 From: buildplan Date: Sun, 21 Sep 2025 13:51:23 +0100 Subject: [PATCH 1/2] stats for actual size at backup storage --- restic-backup.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/restic-backup.sh b/restic-backup.sh index 7e452e5..0097fca 100644 --- a/restic-backup.sh +++ b/restic-backup.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # ================================================================= -# Restic Backup Script v0.28 - 2025.09.20 +# Restic Backup Script v0.29 - 2025.09.21 # ================================================================= set -euo pipefail umask 077 # --- Script Constants --- -SCRIPT_VERSION="0.28" +SCRIPT_VERSION="0.29" SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) CONFIG_FILE="${SCRIPT_DIR}/restic-backup.conf" LOCK_FILE="/tmp/restic-backup.lock" @@ -628,14 +628,26 @@ init_repository() { } run_stats() { + local exit_code=0 echo -e "${C_BOLD}--- Displaying Repository Statistics ---${C_RESET}" - log_message "Displaying repository statistics" - if restic stats 2>&1 | tee -a "$LOG_FILE"; then - log_message "Successfully displayed repository stats" - echo -e "${C_GREEN}✅ Statistics displayed successfully.${C_RESET}" + echo -e "\n${C_CYAN}1. Logical Size (Total size of all unique files across all backups):${C_RESET}" + log_message "Getting repository stats (restore-size)" + if ! restic stats --mode restore-size; then + log_message "ERROR: Failed to get restore-size stats" + echo -e "${C_RED}❌ Failed to get restore-size stats.${C_RESET}" >&2 + exit_code=1 + fi + echo -e "\n${C_CYAN}2. Physical Size (Actual space used on storage):${C_RESET}" + log_message "Getting repository stats (raw-data)" + if ! restic stats --mode raw-data; then + log_message "ERROR: Failed to get raw-data stats" + echo -e "${C_RED}❌ Failed to get raw-data stats.${C_RESET}" >&2 + exit_code=1 + fi + if [ "$exit_code" -eq 0 ]; then + echo -e "\n${C_GREEN}✅ Statistics displayed successfully.${C_RESET}" + return 0 else - log_message "ERROR: Failed to retrieve repository statistics" - echo -e "${C_RED}❌ Failed to retrieve repository statistics. Check connection and credentials.${C_RESET}" >&2 return 1 fi } From c3e5430b8666558a4488768119cd898b3f74afdf Mon Sep 17 00:00:00 2001 From: buildplan Date: Sun, 21 Sep 2025 13:57:18 +0100 Subject: [PATCH 2/2] sha256 for v0.29 --- restic-backup.sh.sha256 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restic-backup.sh.sha256 b/restic-backup.sh.sha256 index 7686d7f..0592d1c 100644 --- a/restic-backup.sh.sha256 +++ b/restic-backup.sh.sha256 @@ -1 +1 @@ -5825ecea08b3a346d7a1682b54b0602d5c028344d437bff5bb2c6f8e4ffdf35f restic-backup.sh +25b2f26099b3fce37ab0040c24d647dbc46b77d1411bd9cfec2bdd2d19cc971d restic-backup.sh