wait-for-postgresql.sh 243 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/bin/sh set -ex check_pg() { pg_isready -h ${POSTGRESQL_HOST} -U postgres } while ! check_pg; do echo "Waiting for database" 1>&2 sleep 1 count=5 while [ $count -gt 0 ] && ! check_pg; do count=$(($count - 1)) sleep 1 done done