summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.shenv7
-rw-r--r--.ssh/config3
-rw-r--r--.zshrc8
3 files changed, 16 insertions, 2 deletions
diff --git a/.shenv b/.shenv
index eb23c6e4..8191085b 100755
--- a/.shenv
+++ b/.shenv
@@ -127,6 +127,13 @@ export BROWSER
TERMCMD="urxvt"
export TERMCMD
+# "Setting the monitor port to 0 turns the monitoring function off,
+# and autossh will only restart ssh upon ssh's exit."
+#
+# We rely on ServerAliveInterval and ServerAliveCountMax set in ~/.ssh/config
+AUTOSSH_PORT=0
+export AUTOSSH_PORT
+
# ---- set pager
lessf=$(which less)
diff --git a/.ssh/config b/.ssh/config
index 091deaca..aa0854a5 100644
--- a/.ssh/config
+++ b/.ssh/config
@@ -115,7 +115,8 @@ Host *
ControlMaster auto
ControlPath /tmp/ssh-%u-%r@%h:%p
ControlPersist 4h
-ServerAliveInterval 5
+ServerAliveInterval 20
+ServerAliveCountMax 3
ForwardAgent no
NoHostAuthenticationForLocalhost yes
ExitOnForwardFailure yes
diff --git a/.zshrc b/.zshrc
index 5975a65f..aad4d52e 100644
--- a/.zshrc
+++ b/.zshrc
@@ -68,7 +68,7 @@ alias mrs="mr -m status"
alias screen="screen -U" # enable UTF-8
alias tmux="tmux"
alias rax="screen -URaAx"
-alias ta="tmux attach"
+alias ta="tmux attach-session"
alias blogdates="rdate.py-dir ~/html/blog/entries"
alias httpdir="sudo python -m SimpleHTTPServer 80"
@@ -112,6 +112,12 @@ copy-to-develacc () {
done
}
+# idea from
+# https://coderwall.com/p/aohfrg/smux-ssh-with-auto-reconnect-tmux-a-mosh-replacement
+smux () {
+ autossh -M 0 -t "$@" "tmux attach-session"
+}
+
# This alias is more reliable than calling `server-start' in my Emacs
# init file. Previously, I was seeing Emacs fail to start with "Error
# reading from stdin." See <http://emacs.stackexchange.com/a/12789>