github.com/rkt/rkt@v1.30.1-0.20200224141603-171c416fac02/Documentation/examples/build-container/play-example/wait-for-postgres.sh (about) 1 #!/bin/bash 2 # wait-for-postgres.sh 3 4 set -e 5 6 host="$1" 7 shift 8 cmd="$@" 9 10 until psql -h "$host" -U "postgres" -c '\q'; do 11 >&2 echo "Postgres is unavailable - sleeping" 12 sleep 10 13 done 14 15 >&2 echo "Postgres is up - executing command" 16 exec $cmd