From cc90f62ceb6ca1e3a701ef03dded324ac4f785d2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Feb 2010 19:29:54 +0000 Subject: [PATCH] * 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 --- modules/services/databases/postgresql.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/services/databases/postgresql.nix b/modules/services/databases/postgresql.nix index df41fdad513..c943b662459 100644 --- a/modules/services/databases/postgresql.nix +++ b/modules/services/databases/postgresql.nix @@ -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 ''; # */