]> code.delx.au - monosys/commitdiff
ssh-screen-wrapper auto-reconnect
authorJames Bunton <jamesbunton@delx.net.au>
Thu, 19 Mar 2015 08:44:45 +0000 (19:44 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Thu, 19 Mar 2015 08:44:45 +0000 (19:44 +1100)
scripts/ssh-screen-wrapper

index ee5aa6dbc1b45e7da69b79f9bc47e69c401d15ac..0dfc6a43159642edda0bac7dfdcda82147c5c081 100755 (executable)
@@ -12,5 +12,17 @@ else
     hostname="$public_hostname"
 fi
 
-exec ssh "$hostname" "$@" -t "bash --login -c 'screen -dR'"
+while true; do
+    clear
+    echo "Connecting to ${hostname}..."
+    ssh \
+        -o ServerAliveInterval=1 \
+        -o ServerAliveCountMax=5 \
+        -t \
+        "$hostname" \
+        "bash --login -c 'screen -dR'" \
+    && exit 0
+    echo "Disconnected, waiting..."
+    sleep 1
+done