Back-port a PG 9.1 logic change to allow "pg_ctl start -w" to fail in less than the -t timeout interval if the postmaster has clearly failed. This is the minimum needed to make it sane to use this method of launching the postmaster from a systemd service file. 9.1 will make this area considerably more robust. diff -Naur postgresql-9.0.4.orig/src/bin/pg_ctl/pg_ctl.c postgresql-9.0.4/src/bin/pg_ctl/pg_ctl.c --- postgresql-9.0.4.orig/src/bin/pg_ctl/pg_ctl.c 2011-04-14 23:15:53.000000000 -0400 +++ postgresql-9.0.4/src/bin/pg_ctl/pg_ctl.c 2011-07-27 18:32:05.547066731 -0400 @@ -538,6 +538,22 @@ #endif print_msg("."); + /* + * The postmaster should create postmaster.pid very soon after + * being started. If it's not there after we've waited 5 or more + * seconds, assume startup failed and give up waiting. (This + * won't cover cases where the postmaster crashes after creating + * the file, nor where there's a pre-existing postmaster, but + * it's better than nothing.) + */ + if (i >= 5) + { + struct stat statbuf; + + if (stat(pid_file, &statbuf) != 0) + break; + } + pg_usleep(1000000); /* 1 sec */ } }