Diff: SshAlwaysScreen

Differences between version 3 and previous revision of SshAlwaysScreen.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 3 Last edited on April 20, 2016 4:17 pm by PhilHollenback Revert
Older page: version 2 Last edited on April 20, 2016 4:16 pm by PhilHollenback Revert
@@ -1,4 +1,10 @@
+This has saved my butt many times.  
+  
+You could substitute tmux if you want, I just don't know the equivalent of screen's <code>-D -RR</code> functionality..  
+  
+One annoyance is double login for login failures not related to screen.  
+  
 <pre> 
 # always use screen on remote hosts if possible 
 ssh () 
 

version 3

This has saved my butt many times.

You could substitute tmux if you want, I just don't know the equivalent of screen's -D -RR functionality..

One annoyance is double login for login failures not related to screen.

# always use screen on remote hosts if possible
ssh ()
{
    if [ x$1 = x ]
    then
        # ssh doesn't make sense without arguments
        echo "must supply hostname" >%2
    elif [ x"$2" = "x" ]
    then
        # only hostname specified, try to ssh and launch screen
        if ! /usr/bin/ssh -t $1 screen -A -D -RR
        then
            # if attempt to launch screen failed, fall back to regular
            # ssh
            /usr/bin/ssh $@
        fi
    else
        # if user passes more than one arg, it's something to execute
        # on remote host, and thus we don't want to launch remote
        # screen.
        /usr/bin/ssh $@
    fi
}

CategoryGeekStuff
CategoryLinuxStuff



Our Founder
ToolboxClick to hide/show