Created
December 3, 2017 21:46
-
-
Save pamtrak06/2942341a866ef0e519fbedc4c43b2710 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
#!/bin/bash | |
# wait-for-postgres.sh | |
# source : https://docs.docker.com/compose/startup-order/ | |
set -e | |
host="$1" | |
shift | |
cmd="$@" | |
until psql -h "$host" -U "postgres" -c '\q'; do | |
>&2 echo "Postgres is unavailable - sleeping" | |
sleep 1 | |
done | |
>&2 echo "Postgres is up - executing command" | |
exec $cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment