Created
June 15, 2022 08:23
-
-
Save acodeninja/bea00a6df32674cd63510ede43727fab to your computer and use it in GitHub Desktop.
A simple script to wait for a service's port to open.
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 sh | |
WAIT_FOR_HOST=$1 | |
WAIT_FOR_PORT=$2 | |
while ! nc -z "$WAIT_FOR_HOST" "$WAIT_FOR_PORT"; do | |
sleep 0.3 | |
echo "INFO [wait-for] Checking $WAIT_FOR_HOST:$WAIT_FOR_PORT" | |
done | |
echo "INFO [wait-for] Connected $WAIT_FOR_HOST:$WAIT_FOR_PORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment