X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=prof-remote;fp=prof-remote;h=d84889448e840fed321355154e4c5c44cdbd36ab;hb=768363d8771edb9d9ed82425fa772d77b90139c0;hp=0000000000000000000000000000000000000000;hpb=62c4ef27d7ce99c442339d4868aa75b2edadfb8f;p=distro-setup diff --git a/prof-remote b/prof-remote new file mode 100755 index 0000000..d848894 --- /dev/null +++ b/prof-remote @@ -0,0 +1,25 @@ +#!/bin/bash + + +set -e; . /usr/local/lib/err; set +e + +remote=$1 +fastcon=0 +while true; do + start=$EPOCHSECONDS + ssh -t $remote screen -Dr -S profanity + if (( EPOCHSECONDS > start + 600 )); then + fastcon=0 + fi + # we try to reconnect quickly for a while (just once as I write this), + # then try to reconnect slowly. + if (( fastcon < 1 )); then + echo "waiting 10. any key to cancel" + read -rsN1 -t 10 ||: + fastcon=$((fastcon+1)) + else + echo "waiting 120. any key to cancel" + # like sleep but stop on any input + read -rsN1 -t 120 ||: + fi +done