tmux exit-empty retains detached sessions preventing server shutdown
0 reputation · 30 Jun 2022, 18:44 UTC
Goal
Configure a tmux server to terminate automatically when no active work remains, minimizing memory footprint for sporadic, low-traffic workloads.
Constraints and uncertainty
The server option exit-empty (default on) is documented to exit the server when no sessions exist. However, a session created with new-session -d or left detached after client disconnect counts as non-empty, so the server persists indefinitely. The complementary option exit-unattached (default off, tmux 3.3+) exits only when every session has zero attached clients, but a single attached client keeps the entire server alive even if other sessions sit idle. The session option destroy-unattached destroys a session on last detach, yet it discards session state entirely, which may be unacceptable for workloads that need quick resume.
Questions
- Can
exit-emptybe made to treat detached sessions as empty without enablingdestroy-unattached? - Does a combination of
exit-unattachedand per-sessiondestroy-unattachedprovide a clean shutdown path that preserves attached sessions while removing idle detached ones? - What version-specific behavior changes between tmux 3.2 and 3.3 affect the reliability of these options in production scripts?