* Use `psql' with an empty command to check whether PostgreSQL is up

and running.  `pg_ctl status' merely checks whether PostgreSQL is
  running, not whether it is already accepting connections.  This
  causes Upstart jobs that depend on PostgreSQL to fail.

svn path=/nixos/trunk/; revision=20024
This commit is contained in:
Eelco Dolstra 2010-02-15 19:29:54 +00:00
parent 83b76bc2cf
commit cc90f62ceb

View file

@ -150,8 +150,10 @@ in
# database is running.
${run} -c '${postgresql}/bin/pg_ctl start -o "${toString flags}"'
# So wait until the server is running.
while ! ${run} -c '${postgresql}/bin/pg_ctl status'; do
# So wait until the server is up. `pg_ctl status' doesn't
# work (apparently, it just checks whether the server is
# running), so try to connect with psql.
while ! ${postgresql}/bin/psql postgres -c ""; do
sleep 1
done
''; # */