Created
November 18, 2021 04:16
-
-
Save rhamaa/ef4280e813cce714b25d426d779096ef to your computer and use it in GitHub Desktop.
Waiting for TCP connection is up using simple bash script
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
#!/bin/sh | |
# source : https://github.com/aanand/docker-wait/blob/master/wait | |
set -e | |
host=$(env | grep _TCP_ADDR | cut -d = -f 2) | |
port=$(env | grep _TCP_PORT | cut -d = -f 2) | |
echo -n "waiting for TCP connection to $host:$port..." | |
while ! nc -w 1 $host $port 2>/dev/null | |
do | |
echo -n . | |
sleep 1 | |
done | |
echo 'ok' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment