pg_isready 259 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #!/bin/sh set -ex check_pg() { pg_isready -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -p 5432 } 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