Skip to content

Commit 4ae8c4c

Browse files
authored
Merge pull request #23 from buildplan/progress_bars
Show progress bars in verbose mode
2 parents 5b20444 + df05787 commit 4ae8c4c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

restic-backup.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ MAX_LOG_SIZE_MB="10"
7272
# Days to keep rotated logs
7373
LOG_RETENTION_DAYS="30"
7474

75+
# --- UI / UX ---
76+
# Set the update rate (frames per second) for the progress bar shown during
77+
# interactive runs with the --verbose flag. Default is 4 if unset.
78+
# Set to a value like "10" for more updates or "1" for fewer.
79+
PROGRESS_FPS_RATE="4"
80+
7581
# --- Notifications ---
7682
# Enable notifications
7783
NTFY_ENABLED=true

restic-backup.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env bash
22

33
# =================================================================
4-
# Restic Backup Script v0.35 - 2025.09.28
4+
# Restic Backup Script v0.36 - 2025.09.29
55
# =================================================================
66

77
set -euo pipefail
88
umask 077
99

1010
# --- Script Constants ---
11-
SCRIPT_VERSION="0.35"
11+
SCRIPT_VERSION="0.36"
1212
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
1313
CONFIG_FILE="${SCRIPT_DIR}/restic-backup.conf"
1414
LOCK_FILE="/tmp/restic-backup.lock"
@@ -586,9 +586,17 @@ send_notification() {
586586
setup_environment() {
587587
export RESTIC_REPOSITORY
588588
export RESTIC_PASSWORD_FILE
589+
589590
if [ -n "${GOMAXPROCS_LIMIT:-}" ]; then
590591
export GOMAXPROCS="${GOMAXPROCS_LIMIT}"
591592
fi
593+
594+
# Enable progress bar for interactive --verbose runs
595+
if [[ "${VERBOSE_MODE:-false}" == "true" ]] && [ -t 1 ]; then
596+
local fps_rate="${PROGRESS_FPS_RATE:-4}"
597+
export RESTIC_PROGRESS_FPS="${fps_rate}"
598+
fi
599+
592600
if [ -n "${RESTIC_CACHE_DIR:-}" ]; then
593601
export RESTIC_CACHE_DIR
594602
mkdir -p "$RESTIC_CACHE_DIR"
@@ -1504,4 +1512,4 @@ case "${1:-}" in
15041512
;;
15051513
esac
15061514

1507-
echo -e "${C_BOLD}--- Backup Script Completed ---${C_RESET}"
1515+
echo -e "${C_BOLD}--- Backup Script Completed ---${C_RESET}"

restic-backup.sh.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c81e8a05b96574f64acccf3860163e5b15e27d1c264c8ef0d6f98caf80f81af7 restic-backup.sh
1+
0b68152c13941ac17111f3f6cabd3bc3ebb8a6ed51885578db0b5dee4eab7326 restic-backup.sh

0 commit comments

Comments
 (0)