]> arthur.barton.de Git - trigger-rcmd.git/commitdiff
ssh: set "ServerAliveInterval" to 120 seconds
authorAlexander Barton <alex@barton.de>
Sat, 29 Nov 2014 15:47:16 +0000 (16:47 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 29 Nov 2014 15:47:16 +0000 (16:47 +0100)
scripts/trigger-rcmd

index 9c23ae06e227c797d19c6a2930099051a3ff8d87..5d496c1a6df646d03b8cf2d75821d0f033d8d166 100755 (executable)
@@ -73,7 +73,7 @@ do_rcmd() {
 
        for i in `seq 1 $SSH_CHECKS`; do
                echo "$NAME: checking SSH connection ($i/$SSH_CHECKS) ..."
-               ssh -q "$SYSTEM" true >/dev/null 2>&1 && break
+               ssh -q -o "ServerAliveInterval 120" "$SYSTEM" true >/dev/null 2>&1 && break
                echo "$NAME: SSH on \"$SYSTEM\" not ready. Waiting ..."
                sleep 10s
        done
@@ -87,7 +87,7 @@ do_rcmd() {
        echo "$NAME: calling \"$CMD\" on \"$SYSTEM\" ..."
        echo
 
-       ssh -q "$SYSTEM" "$CMD" </dev/null ; r=$?
+       ssh -q  -o "ServerAliveInterval 120" "$SYSTEM" "$CMD" </dev/null ; r=$?
 
        echo
        echo "$NAME: remote command ended with return code $r."
@@ -97,7 +97,7 @@ do_rcmd() {
                rsys_users=`ssh -q "$SYSTEM" w | tail -n +3 | wc -l`
                if [ "$rsys_users" = "0" ]; then
                        echo "$NAME: power off \"$SYSTEM\" again ..."
-                       ssh -q "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
+                       ssh -q  -o "ServerAliveInterval 120" "$SYSTEM" "sync; shutdown -hP $SHUTDOWN_TIME" >/dev/null
                        if [ $? -ne 0 ]; then
                                echo "$NAME: failed to power off \"$SYSTEM\"!" >&2
                                return 5