Re: simply preserving sessions across disconnect

Rich Boyce <rich-jcUp+/l53Jxaa/[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
Hi Adam,

On 29/06/11 20:26, Adam Kellas wrote:
> I think I failed to make the desired usage model clear. I gather most
> people are in the mode of (a) log in, then (b) run "screen", and (c)
> use screen thereafter to multiplex sessions. But my goal is to make
> use of screen completely invisible[*]. In PuTTY one of the
> configurables is the ssh "Remote Command" which by default is $SHELL.
> I'm trying to configure putty with a remote command of "screen
> <some-flags>" such that putty will automatically start up a screen
> instance and that instance will either attach to an existing detached
> session or create a new one. So one putty window == one screen window.
> The idea is that this would be just like not using screen but sessions
> aren't dropped when the network is.

That's precisely how I use screen. The way I do it is to have a snippet 
in my bash login script which tests whether the scripts is running in 
screen already, and if not runs 'screen -RR':

if [ ! $WINDOW ] ; then   # we're not already in screen
	if [ -e `which screen` ]; then  # we've got screen available
		screen -RR       # reattach to first available session
		exit             # logout when finished
	fi
fi

Note that I'm working in a networked environment where my home area is 
the same on my local workstation and all the servers I connect to.

That works just how you're describing what you want. It's transparent 
during normal use, but if the connection to the remote server is lost 
then the session is restored upon reconnect.

Hope this helps!
Rich

-- 
Rich Boyce
Systems Administrator, Desktop Team
EBI Systems Group
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.