Re: simply preserving sessions across disconnect

Kevin Van Workum <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
On Thu, Jun 30, 2011 at 2:29 PM, Adam Kellas <[email protected]> wrote:

> On Thu, Jun 30, 2011 at 10:07 AM, Juergen Weigert <jw-n+aIp8eCc/[email protected]> 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
> screen-users-mXXj517/[email protected]
> 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

_______________________________________________
screen-users mailing list
screen-users-mXXj517/[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.