1

Reading this Q&A on the site: Can I re-attach to a mosh session? made me wonder about the use cases for mosh.

Say I start tmux on my local client, and then mosh to a remote host from within tmux. From this mosh session, I start a long process on the remote machine that e.g. prints info over time to stdout.

Say that I then lose connectivity on my client, or that I restart my local client (for whatever reason). Will I be able to (1) re-attach to my local tmux session, (2) still see my mosh connection alive, and (3) still the server process running and displaying its output in it?

1

yes, yes, yes.

Amongst one of the benefits/uses of tmux is to allow persistence of sessions even if disconnected from the session - this was true even before mosh came along.

tmux handles the signal when you disconnect and the processes running in the session continue without being aware a disconnect happened (similar to launching the process via nohup).

So why is above going to result in 'yes, yes, yes' ?

(1) re-attach to my local tmux session,

Yes, because if you are disconnected from the local tmux session, tmux will handle the SIGHUP and will still continue to run and so when you reconnect you can tmux attach-session

 (2) still see my mosh connection alive, 

Yes, because tmux handled the disconnection signal, the mosh process running within tmux would continue unaware your connection had disconnected and would continue running.

(3) still the server process running and displaying its output in it?

Yes, because mosh still connected and running the server process would still be going and sending output.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.