#!/usr/bin/env bash
set -eu -o pipefail

# Wait until the host yodaNas is reachable with SSH.
while :; do
  result="$(ssh yodaNas 'hostname')" && e=0 || e=$?
  if [ "${e}" = 0 ] && [ "${result}" = 'yodaNas' ]; then
    break
  fi
  printf '%s\n' 'Delaying due to SSH connectivity problems.'
  sleep 10s
done
