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

13 lines
308 B
Bash
Raw Normal View History

2023-11-22 14:32:35 +01:00
#!/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