diff options
| author | Sam Scholten | 2025-10-22 16:44:53 +1000 |
|---|---|---|
| committer | Sam Scholten | 2025-10-22 16:44:53 +1000 |
| commit | 61ca95ae5929928ebfa50b8d99b18cf21c3e2ca7 (patch) | |
| tree | 0124c23545f21aee35107efb42a7827bb93e3179 /restic_backup.sh | |
| parent | 4352c0aedd3236b805977da8fc910fb8f46a9e2d (diff) | |
| download | drestic-1.2.tar.gz drestic-1.2.zip | |
Fix: Replace unsupported restic flags for 0.18.1 compatibilityv1.2
- 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
Diffstat (limited to 'restic_backup.sh')
| -rwxr-xr-x | restic_backup.sh | 12 |
1 files changed, 4 insertions, 8 deletions
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) ---" |
