-
-
Save 7error/79a5bc54603d6b10f598f0056fb5fa13 to your computer and use it in GitHub Desktop.
A better wait-for-postgres.sh
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 -e | |
# wait-for-postgres.sh | |
# Adapted from https://docs.docker.com/compose/startup-order/ | |
# Expects the necessary PG* variables. | |
until psql -c '\l'; do | |
echo >&2 "$(date +%Y%m%dt%H%M%S) Postgres is unavailable - sleeping" | |
sleep 1 | |
done | |
echo >&2 "$(date +%Y%m%dt%H%M%S) Postgres is up - executing command" | |
exec ${@} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment