screen-users
[Top][All Lists]
Advanced

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

Re: simply preserving sessions across disconnect


From: Kevin Van Workum
Subject: Re: simply preserving sessions across disconnect
Date: Thu, 30 Jun 2011 15:58:34 -0400



On Thu, Jun 30, 2011 at 2:29 PM, Adam Kellas <address@hidden> wrote:
On Thu, Jun 30, 2011 at 10:07 AM, Juergen Weigert <address@hidden> wrote:
> I also believe this to be basic, that is why I implemented -D -RR
> It was designed to exactly cover the use case you describe.
> Grab a session if there is one, otherwise create one.

Juergen,

Thanks, it's good to know an author foresaw and supports this use
case. It give me renewed hope this can be made to work.

> Sorry to hear that some of your ssh connections start a fight.
> Although I am not exactly sure what that means.
> Is there something that I missed?

Here's what I observe using PuTTY, which is just an ssh client for
Windows, and connecting to a Fedora-based Linux machine. The "remote
command" for putty is set to "screen -D -RR". At this time screen is
not yet running for me, i.e. "screen -ls" returns "No Sockets found
...".

I then do one putty login and get a new shell within screen. The title
bar says "[screen:0 bash]", "echo $STY" reports a value
"<pid>.pts-14.<hostname>", and "screen -ls" in my control (non-screen)
terminal shows the same thing. To this point everything is going well.

Now I start a second putty connection. This takes the screen window
from the first one. The "echo $STY" command that I ran in the first
putty window is now in the second one, and the first is showing a
"Server unexpectedly closed network connection" error message. The
"screen -ls" still shows just one socket, same one as above. So
clearly the second putty login "stole" the screen window from the
first one.

I'm going to send you privately screen shots demonstrating this. My
employer might quibble about me posting them on a list.


How about creating a script such as follows and running it as your ssh-command.

#!/bin/sh                                                                                      

SESSION=$(screen -ls | grep detached | tail -1 | sed 's/^\s\+//' | sed 's/\s.*$//')

if [ "x${SESSION}" == "x" ]; then
    screen 
else
    screen -R $SESSION
fi


 
Thanks,
AK

_______________________________________________
screen-users mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/screen-users



--
Kevin Van Workum, PhD
Sabalcore Computing Inc.
Run your code on 500 processors.
Sign up for a free trial account.
www.sabalcore.com
877-492-8027 ext. 11


reply via email to

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