#!/bin/sh

host="$1"

echo "waiting for $host to be online..." >&2

pingcheck() {
  ping -n -c 1 -w 5 $1 >/dev/null 2>&1
}

# Do you want a timeout ?
for i in {1..12}; do
    pingcheck ${host} && exit 0
    sleep 10
done
