mostly profanity and fixes
[distro-setup] / prof-remote
1 #!/bin/bash
2
3
4 set -e; . /usr/local/lib/err; set +e
5
6 remote=$1
7 fastcon=0
8 while true; do
9 start=$EPOCHSECONDS
10 ssh -t $remote screen -Dr -S profanity
11 if (( EPOCHSECONDS > start + 600 )); then
12 fastcon=0
13 fi
14 # we try to reconnect quickly for a while (just once as I write this),
15 # then try to reconnect slowly.
16 if (( fastcon < 1 )); then
17 echo "waiting 10. any key to cancel"
18 read -rsN1 -t 10 ||:
19 fastcon=$((fastcon+1))
20 else
21 echo "waiting 120. any key to cancel"
22 # like sleep but stop on any input
23 read -rsN1 -t 120 ||:
24 fi
25 done