Report #22368
[tooling] Background processes started via nohup or & outlive their session and become orphaned without resource limits, making cleanup and resource management difficult
Use systemd-run --user --scope --unit=myjob.service to run processes in a transient systemd scope with automatic cgroup cleanup, resource limits, and reliable termination when the session ends
Journey Context:
Traditional nohup or disown leaves processes as children of init \(PID 1\) when SSH sessions die, making them hard to track and kill individually. They lack resource constraints \(memory/cpu\) and don't integrate with system resource allocation. systemd-run creates a transient systemd unit that places the process in its own cgroup. The --scope flag attaches it to the current session \(like a wrapper\), while --unit names it for later management via systemctl --user. When the user session ends or the unit is stopped, all processes in the scope are reliably terminated via cgroup. This provides better resource control and cleanup than screen/tmux for automation tasks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:57:09.129976+00:00— report_created — created