Skip to content

Instantly share code, notes, and snippets.

@durandj
durandj / wait-for-postgres.sh
Last active February 9, 2020 18:12
Docker Wait Scripts
#!/usr/bin/env bash
# Waits for a Postgres database to be ready before calling the passed
# command. After each failed attempt to reach the database, the script
# sleeps for a fixed period of time (versus an exponential backoff).
#
# The database connection arguments are to be passed to psql via
# the standard Postgres environment variables.
#
# Unfortunately the way this script works, the Postgres client must