I want to protect a remote SSH session against network drop-outs.
screen can do that. It'd be more convient to be able to use exactly the
same command line whether creating a session or re-attaching to an
existing one. screen can do that.
But what's hateful is working out which of screen's many, many, many
seemingly related options I want to do that. I Googled, hoping that
somebody else would already have done this ... and in less time than it
would've taken to read the relevant parts of screen's manpage I learnt
of, installed, read the complete docs for, and started using dtach.
Here's a sumary of the options screen offers -- for re-attaching:
-r resumes a detached screen session.
-R attempts to resume the youngest detached screen session it
finds.
And for detaching:
-d does not start screen, but detaches the elsewhere running
screen session.
-D is the equivalent to the power detach key.
Except that if you're using the above in combination then they have
meanings that you wouldn't guess from the combination of their
descriptions -- you can even get slightly different behaviour yet again
by doubling some options:
-d -r Reattach a session and if necessary detach it first.
-d -R Reattach a session and if necessary detach or even create it
first.
-d -RR Reattach a session and if necessary detach or create it. Use
the first session if more than one session is available.
-D -r Reattach a session. If necessary detach and logout remotely
first.
-D -R Attach here and now.
-D -RR Attach here and now. Whatever that means, just do it.
Hateful!
Smylers