[mosh-users] mosh feature request

Mike Grant mggr at pml.ac.uk
Tue Jul 3 17:46:13 EDT 2012


On 07/03/2012 01:10 AM, Keith Winstein wrote:
> We don't have this feature now as part of Mosh. Most users who want to

+1 to the feature request, though I'm mostly suspending/hibernating my
laptop these days and thus don't suffer too much, except when using
multiple machines.  However, mosh is a huge improvement for many other
reasons (personally I love the way CTRL-C works immediately and the ease
of using mosh over a terrible mobile broadband connection).

> On Sat, Jun 30, 2012 at 9:32 AM, Darren Mackay <darren at dmerfc.com> wrote:
>> Currently, I usually SSH to the host, then run "screen -list" and then
>> "screen -R xx" to connect to the desired screen session

When I used ssh more, I did similar and eventually wrote a little script
(attached) to automatically reattach to a named session.  It'd be nice
to update this for mosh.

Cheers,

Mike.

<br />
<hr />
<p><font face="Arial" size="1">
Plymouth Marine Laboratory<br />
Registered Office: <br />
Prospect Place<br />
The Hoe<br />
Plymouth  PL1 3DH
</font></p>

<p><font face="Arial" size="1">Website: <a href="http://www.pml.ac.uk">www.pml.ac.uk</a>
<br />
<a href="http://www.pml.ac.uk/pdf/PML%20Annual%20Review%202011_2.pdf">Click here for the latest PML Annual Review</a>
<br />
Registered Charity No. 1091222<br />
PML is a company limited by guarantee<br />
registered in England & Wales<br />
company number 4178503</font></p>

<p><font face="Arial" size="1" color="green">Please think before you print.</font></p>

<hr />

<p><font face="Arial" size="1">This e-mail, its content and any file attachments are confidential.</font></p>

<p><font face="Arial" size="1">If you have received this e-mail in error please do not copy, disclose it to any third party or use the contents or attachments in any way. Please notify the sender by replying to this e-mail or e-mail forinfo at pml.ac.uk and then delete the email without making any copies or using it in any other way.</font></p>

<p><font face="Arial" size="1">The content of this message may contain personal views which are not the views of Plymouth Marine Laboratory unless specifically stated.</font></p>

<p><font face="Arial" size="1">You are reminded that e-mail communications are not secure and may contain viruses. Plymouth Marine Laboratory accepts no liability for any loss or damage which may be caused by viruses.</font></p>

<hr />
<br />
<br />

-------------- next part --------------
#!/bin/sh
#
# Script to wrap up autossh and screen to automatically reconnect
# to a named persistent screen session
#
# Author: mggr at pml.ac.uk
# Date: 14 March 2011
# License: GPLv3
#

function usage()
{
   echo "Usage: `basename $0` [user@]host [session name]"
   echo 
   echo "Start a persistent and auto-reattaching ssh+screen session on a remote host"
   echo
   echo "if no session name is specified, a new session is started"
   echo "if a session name is specified and exists on the remote host, it will be"
   echo "resumed ; otherwise it will be created"
}


if [ "$#" -lt "1" -o "$#" -gt "2" ] ; then
   usage
   exit 1
elif [ "$1" == "-h" -o "$1" == "--help" ] ; then
   usage
   exit 0
fi

if [ "$2" == "" ] ; then
   echo "Starting unnamed session on $1"
   autossh -M 0 -t $1 "screen -e^Aa"
else
   echo "Starting / resuming named session $2 on $1"
   autossh -M 0 -t $1 "export SCREENSESSION=\`screen -ls | egrep -w "[0-9]+\.$2" |cut -f2\`; if [ -z "\$SCREENSESSION" ] ; then screen -e^Aa -S $2; else screen -D -R \$SCREENSESSION ; fi"
fi


More information about the mosh-users mailing list