Scope the migration's busy check to the installation being migrated

This commit is contained in:
Gmer4Lfe
2026-08-08 23:53:13 -04:00
parent e406bd445d
commit 38cd3edf99
+8 -2
View File
@@ -99,10 +99,16 @@ say() { printf ' %s\n' "$*"; }
step() { printf '\n━━━ %s ━━━\n' "$*"; } step() { printf '\n━━━ %s ━━━\n' "$*"; }
# ── Guard: orchestrators mid-run ────────────────────────────────────────────── # ── Guard: orchestrators mid-run ──────────────────────────────────────────────
# Scoped to THIS installation's path, not to the script names. pgrep is system-wide, and a box
# running both a production checkout and a development clone will always have one of them busy —
# matching on "Orchestrators/" alone made a dev migration abort because prod was mid-cycle, which
# is a process that cannot touch this tree's data at all. The full path is what distinguishes
# them, so that is what is matched.
if [[ "$FORCE" == false && "$DRY_RUN" == false ]]; then if [[ "$FORCE" == false && "$DRY_RUN" == false ]]; then
running=$(pgrep -fa 'Orchestrators/|Watchdogs/' 2>/dev/null | grep -v "$$" | grep -v migrate_data_layout || true) running=$(pgrep -fa "$ROOT/(Orchestrators|Watchdogs|Media|Rsync)/" 2>/dev/null \
| grep -v "$$" | grep -v migrate_data_layout || true)
if [[ -n "$running" ]]; then if [[ -n "$running" ]]; then
echo "[ABORT] Orchestrator or watchdog is running — it may rewrite state mid-move:" >&2 echo "[ABORT] A job from this installation is running — it may rewrite state mid-move:" >&2
echo "$running" >&2 echo "$running" >&2
echo "Wait for it to finish, or re-run with --force if you are sure." >&2 echo "Wait for it to finish, or re-run with --force if you are sure." >&2
exit 1 exit 1