From cfc8efcbdad178998f6168f0ec2524df2b28cd7f Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Tue, 18 Oct 2016 16:15:47 +0200 Subject: [PATCH] Move wait_ssh() to tct/conf/conf.sh Change-Id: I55f0426b19a503ca998e711d350d5c4249381848 Signed-off-by: Aleksander Mistewicz --- tct/conf/conf.sh | 43 ++++++++++++++++++++++++++++++++++++++++ tct/minnow_prepare_flash_conf.sh | 37 +--------------------------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/tct/conf/conf.sh b/tct/conf/conf.sh index b8d8d00..26f0d21 100755 --- a/tct/conf/conf.sh +++ b/tct/conf/conf.sh @@ -77,6 +77,49 @@ copy_ssh() { done } +wait_ssh() { + SDMUX="$1" + test -n "${SDMUX}" || die "Missing argument: sdmux" + + CONNECT_CNT=0 + SLEEP=${INIT_SLEEP} + + sleep "${SLEEP}" + + while ! ping -c 1 "${IP}" -W 1 | grep -q icmp_seq + do + printf "," + if [ ${SLEEP} -ge ${MAX_SLEEP} ] + then + die "Timeout: host not found in the network!" + fi + if [ ${SLEEP} -ge ${RESTART_SLEEP} ] + then + echo "Restarting ${SDMUX}" >&2 + restart_device "${SDMUX}" + fi + sleep "${SLEEP}" + SLEEP=$((SLEEP+INC_SLEEP)) + CONNECT_CNT=$((CONNECT_CNT+1)) + done + + printf "\n" >&2 + + SLEEP=10 + + while ! nc -q 1 "${IP}" 22 &2 - restart_device "${SDMUX}" - fi - sleep "${SLEEP}" - SLEEP=$((SLEEP+INC_SLEEP)) - CONNECT_CNT=$((CONNECT_CNT+1)) -done - -printf "\n" - -SLEEP=10 - -while ! nc -q 1 "${IP}" 22 sysctl.result -- 2.7.4