nix-git/examples/block-until-remote-reachable.sh

13 lines
308 B
Bash

#!/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