Been using the screen utility for years until tmux started to be included in distros instead.
With some use and research found the best way to make the session ‘reentrant’ to survive disconnections was to write a little script, viz.:
[…]
#!/usr/bin/bash
tmux start-server
#create a session with four windows
tmux new-session -d -AD -s 0 -n BTop btop
tmux new-window -t 0:1 -n “Midnight Commander” mc
tmux new-window -t 0:2 -n “Default Shell”
tmux new-window -t 0:3 -n “Shell” ‘duf; bash’
#tmux new-window -t 0:4 -n …
tmux attach -t0
[…]
So, each time I reconnect ssh it pickups up current session or creates new with prepopulated windows ready to go.
;-}
P