[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reestablishing ssh connections via screen

From: Andy Goth
Subject: Re: Reestablishing ssh connections via screen
Date: Tue, 21 Jun 2005 16:20:05 -0500
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

JCA wrote:
>   I have a Linux notebook that connects to a Linux server by ssh. The
> notebook can be suspended to disk at any time, while ssh sessions to
> the server are still running. How can screen be used so that, when the
> notebook is brought back from its dormant state, whatever ssh sessions
> it had active with the server, at the time the notebook was put to
> sleep, are automatically re-established?

I dunno how you would set up your laptop to do this, but all that's
really needed is for you to ssh back to every computer you had
previously connected to (however, the connections might just still be
alive when you wake) and run "screen -r" on each host.  This will
reconnect to detached screen sessions.

But there are some interesting cases to watch out for...  What if the
detached screen session has died?  What if the previous ssh connection
is still up (or the Linux server hasn't noticed the HUP)?  What if there
was no screen session in the first place?

So look into the -d, -D, -r, -R, -RR, and -x options plus combinations

At the laptop end of things, you can maybe make a script for ssh'ing to
a remote host and running screen.  This script would keep track of all
such connections.  Another script would attempt to resume each "active"
connection in the log.  Use the former instead of manual ssh/screen and
the latter (automatically, I hope) upon wake.

Andy Goth

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]