From 61ca95ae5929928ebfa50b8d99b18cf21c3e2ca7 Mon Sep 17 00:00:00 2001 From: Sam Scholten Date: Wed, 22 Oct 2025 16:44:53 +1000 Subject: Fix: Replace unsupported restic flags for 0.18.1 compatibility - Replace --lock-retry-after and --lock-stale-timeout with --retry-lock - Fix shell script quoting issues (SC2086, SC2046) - All tests passing: local, remote, lint, format --- restic_backup.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'restic_backup.sh') diff --git a/restic_backup.sh b/restic_backup.sh index cc749e6..b68d299 100755 --- a/restic_backup.sh +++ b/restic_backup.sh @@ -37,28 +37,25 @@ restic backup \ --exclude-file "${CONFIG_DIR}/excludes" \ --password-file "${RESTIC_PASSWORD_FILE}" \ --option rclone.timeout=20m \ - --lock-retry-after 5m \ - --lock-stale-timeout 24h \ + --retry-lock 5m \ --tag daily || { echo "Error: Restic backup failed." >&2 notify "Restic Backup ($(whoami)@$(hostname))" "Backup phase failed!" 8 exit 1 } - # Prune old snapshots - only on specific hours to avoid conflicts HOUR=$(date +%H) # Only prune between 2-4 AM to reduce multi-device conflicts -if [ $HOUR -ge 2 ] && [ $HOUR -lt 4 ]; then +if [ "$HOUR" -ge 2 ] && [ "$HOUR" -lt 4 ]; then # Add random delay to stagger multiple devices - sleep $(shuf -i 0-1800 -n 1) # 0-30 minutes random delay + sleep "$(shuf -i 0-1800 -n 1)" # 0-30 minutes random delay echo "Applying Restic retention policy and pruning old snapshots..." restic forget \ --repo "${RESTIC_REPOSITORY}" \ --password-file "${RESTIC_PASSWORD_FILE}" \ --option rclone.timeout=20m \ - --lock-retry-after 5m \ - --lock-stale-timeout 24h \ + --retry-lock 5m \ --keep-daily 7 \ --keep-weekly 4 \ --keep-monthly 6 \ @@ -72,5 +69,4 @@ else echo "Skipping prune - only running between 2-4 AM to avoid multi-device conflicts" fi - echo "--- Restic Backup finished at $(date) ---" -- cgit v1.2.3