SshAlwaysScreen
Note: You are viewing an old revision of this page. View the current version.
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 }