Wait for SSH service to become ready
authorAlexander Barton <alex@barton.de>
Mon, 24 Nov 2014 19:12:53 +0000 (20:12 +0100)
committerAlexander Barton <alex@barton.de>
Mon, 24 Nov 2014 19:12:53 +0000 (20:12 +0100)
scripts/trigger-rcmd

index 97f4efafc9a75a29143de6b341916e087cbd03f0..c21a21f55103bdca0484092b81660181445f4fb0 100755 (executable)
@@ -25,6 +25,7 @@ do_rcmd() {
        IFACE="eth0"
        CMD="uptime"
        TIMEOUT="180"
+       SSH_CHECKS="6"
 
        . "$cnf"
 
@@ -67,6 +68,13 @@ do_rcmd() {
                rsys_was_running=1
        fi
 
+       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
+               echo "$NAME: SSH on \"$SYSTEM\" not ready. Waiting ..."
+               sleep 10s
+       done
+
        echo "$NAME: calling \"$CMD\" on \"$SYSTEM\" ..."
        echo