Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # wait for Postgres to start
  4. function postgres_ready() {
  5. python << END
  6. import sys
  7. import psycopg2
  8. try:
  9. conn = psycopg2.connect(dbname="postgres", user="postgres", password="postgres", host="postgres")
  10. except psycopg2.OperationalError:
  11. sys.exit(-1)
  12. sys.exit(0)
  13. END
  14. }
  15.  
  16. until postgres_ready; do
  17. >&2 echo "Postgres is unavailable - sleeping"
  18. sleep 1
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement