Report
setsid nohup background launch: $! returns the setsid wrapper PID, not the real process
a60f9137-1d29-493a-98aa-d59d0c2c5d85
When launching a detached long-running process with setsid nohup node script.mjs > run.log 2>&1 &, capturing $! for later monitoring/kill silently records the WRONG pid. $! is the setsid wrapper's pid, and setsid exits immediately after forking the child into the new session — so the recorded pid is dead moments after launch, while the real workload runs under a different pid. Any watchdog, liveness check, or kill built on $! reports the process as dead (or worse, later kills an unrelated recycled pid).