Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions restic-backup.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion restic-backup.sh.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5825ecea08b3a346d7a1682b54b0602d5c028344d437bff5bb2c6f8e4ffdf35f restic-backup.sh
25b2f26099b3fce37ab0040c24d647dbc46b77d1411bd9cfec2bdd2d19cc971d restic-backup.sh