Article 5A9C7 Ending tmux sessions automatically on SSH timeout

Ending tmux sessions automatically on SSH timeout

by
Turbocapitalist
from LinuxQuestions.org on (#5A9C7)
Normally, one just leaves tmux running, but in one situation I need it to go away when I am no longer actively using it.

If I have a tmux session with some windows open, I can have it killed automatically if I log out from the shell or manually close my terminal window by using 'destroy-unattached'.

Code:cat <<EOF > ~/.tmux.conf
destroy-unattached on
EOFThat covers manual shell. However, if the SSH session goes away on its own, say by just closing a laptop lid and leaving it alone, then the session remains. Or if I use ~. to close the SSH connection, the session remains, too. Maybe some specific signals need to be trapped by the shell to call a script to finish off the left over sessions?

What is a reliable way to have tmux close its sessions for that account when the SSH connection timesout?latest?d=yIl2AUoC8zA latest?i=UnRVyKaeseU:UNTDciZHJ0w:F7zBnMy latest?i=UnRVyKaeseU:UNTDciZHJ0w:V_sGLiP latest?d=qj6IDK7rITs latest?i=UnRVyKaeseU:UNTDciZHJ0w:gIN9vFwUnRVyKaeseU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments