diff options
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) ---" |
