Skip to content

Instantly share code, notes, and snippets.

@bitkill
Last active July 29, 2020 15:02
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 bitkill/7c9a8542d7da83ef66e067069db1b210 to your computer and use it in GitHub Desktop.
Save bitkill/7c9a8542d7da83ef66e067069db1b210 to your computer and use it in GitHub Desktop.
Wait for a service via tcp
#!/usr/bin/env bash
RETRIES=10
while !</dev/tcp/postgres/5432 & [ $RETRIES -eq 0 ]; do
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts...";
sleep 1;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment