diff --git a/bin/stacks b/bin/stacks index ea3af68..cc87dca 100755 --- a/bin/stacks +++ b/bin/stacks @@ -650,8 +650,11 @@ _backup_run() { # --- Prune --- log "Pruning old snapshots" - restic forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 2>&1 \ - || warn "restic forget failed" + local prune_failed=false + if ! restic forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 2>&1; then + err "restic forget/prune failed (stale lock? try: restic unlock)" + prune_failed=true + fi # --- Summary --- local snapshot_info repo_stats summary @@ -664,6 +667,13 @@ _backup_run() { [[ -n "$snapshot_info" ]] && summary+="\nLatest: \`$snapshot_info\`" [[ -n "$repo_stats" ]] && summary+="\nRepo: $repo_stats" + if $prune_failed; then + summary+="\nāŒ **Prune FAILED** — repo is growing unpruned (stale lock?). Check \`journalctl -u stacks-backup\`." + _notify "#cc0000" "$summary" + err "Backup saved, but prune failed" + return 1 + fi + _notify "#36a64f" "$summary" log "Backup complete" }