Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # wait for Postgres to start
- function postgres_ready() {
- python << END
- import sys
- import psycopg2
- try:
- conn = psycopg2.connect(dbname="postgres", user="postgres", password="postgres", host="postgres")
- except psycopg2.OperationalError:
- sys.exit(-1)
- sys.exit(0)
- END
- }
- until postgres_ready; do
- >&2 echo "Postgres is unavailable - sleeping"
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement