diff --git a/packages/scheduler/wait-for.sh b/packages/scheduler/wait-for.sh new file mode 100755 index 000000000..f3d72b834 --- /dev/null +++ b/packages/scheduler/wait-for.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +host="$1" +shift +port="$1" +shift +cmd="$@" + +while ! nc -vz $host $port; do + >&2 echo "$host:$port is unavailable yet - waiting for it to start" + sleep 10 +done + +>&2 echo "$host:$port is up - executing command" +exec $cmd