I wrote a test case for this. It seems that postgresql does a rather bad job of reporting the problem when the disk is full.
- First hurdle is that pg_ctlcluster redirects pg_ctl's stdout and error to /dev/null, as you need to detach it from the current terminal (as per manpage). But that can be fixed by redirecting it to a pipe instead.
- Second, we do not call pg_ctl with -w to wait for the startup. I think we should, it should get us rid of the port polling.
But even after this, the postmaster does not report any error:
$ /usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/test -l /var/log/postgresql/postgresql-9.1-test.log -w -o '-c config_file="/etc/postgresql/9.1/test/postgresql.conf"'
waiting for server to start........ stopped waiting
pg_ctl: could not start server
Examine the log output.
So before this gets useful, we'll need to fix pg_ctl/postmaster first to actually do report the error to stderr.
I wrote a test case for this. It seems that postgresql does a rather bad job of reporting the problem when the disk is full.
- First hurdle is that pg_ctlcluster redirects pg_ctl's stdout and error to /dev/null, as you need to detach it from the current terminal (as per manpage). But that can be fixed by redirecting it to a pipe instead.
- Second, we do not call pg_ctl with -w to wait for the startup. I think we should, it should get us rid of the port polling.
But even after this, the postmaster does not report any error:
$ /usr/lib/ postgresql/ 9.1/bin/ pg_ctl start -D /var/lib/ postgresql/ 9.1/test -l /var/log/ postgresql/ postgresql- 9.1-test. log -w -o '-c config_ file="/ etc/postgresql/ 9.1/test/ postgresql. conf"'
waiting for server to start........ stopped waiting
pg_ctl: could not start server
Examine the log output.
So before this gets useful, we'll need to fix pg_ctl/postmaster first to actually do report the error to stderr.