Created
September 5, 2022 06:10
-
-
Save ivorpad/588732add5b2e39eb4ab361333c55f36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# wait for a program to start listening on a PORT ($1) | |
wait_for_port() { | |
local PORT=$1 | |
echo "waiting for $PORT" | |
for i in `seq 1 60`; | |
do | |
nc -z localhost $PORT && echo "port $PORT is ready" && return | |
echo -n . | |
sleep 1 | |
done | |
echo "Failed waiting for $PORT" && exit 1 | |
} | |
# wait_for_port 5432 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment