Re: Reliably determining whether the server came up - Mailing list pgsql-admin

From Tom Lane
Subject Re: Reliably determining whether the server came up
Date
Msg-id 22317.1227032425@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reliably determining whether the server came up  (Mischa Sandberg <mischa_sandberg@telus.net>)
Responses Re: Reliably determining whether the server came up
List pgsql-admin
Mischa Sandberg <mischa_sandberg@telus.net> writes:
> Quoting Tom Lane <tgl@sss.pgh.pa.us>:
>> I'd bet that the pg_ctl status part is failing.  I get exit status 1
>> from it if there's no server running.

> Yes, that was part of the problem with the original startup script;
> postmaster hadn't even gotten as far as writing postmaster.pid,
> I guess. But pg_ctl status returning 1 could also mean that that the
> server had come up, hit a critical problem and exited. Hence my problem;
> this has to detect server failure, reliably, as well.

You could sleep for a second or so *before* you start looking for the
pidfile.

> In another vein, another place where there are consistent
> failures is in the sequence:

>    createlang ... -d template1 plpgsql
>    createdb $PGDATABASE
>    <app>

This should be fixed in 8.3 and up.  In older releases about all you
can do is delay a second or so to let the old backend exit.

            regards, tom lane

pgsql-admin by date:

Previous
From: "Marcelo Costa"
Date:
Subject: Re: Changing encoding
Next
From: Mischa Sandberg
Date:
Subject: Re: Reliably determining whether the server came up