Skip to content

Instantly share code, notes, and snippets.

@terenty-rezman
Created October 23, 2021 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terenty-rezman/0b14370492fd18e990947d50ac0f3b9c to your computer and use it in GitHub Desktop.
Save terenty-rezman/0b14370492fd18e990947d50ac0f3b9c to your computer and use it in GitHub Desktop.
docker curl wait for db available
#!/bin/sh
# wait_for_tcp.sh
# wait for tcp port to become available
# usage
# $ ./wait_for_tcp localhost:80
host="$1"
until echo -e '\xdclose\x0d' | curl -v telnet://$host/ ; do
>&2 echo "${host} is unavailable - sleeping..."
sleep 1
done
echo "${host} is available"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment