Skip site navigation (1) Skip section navigation (2)

Re: Reliably determining whether the server came up

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mischa Sandberg <mischa_sandberg(at)telus(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Reliably determining whether the server came up
Date: 2008-11-18 18:20:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Mischa Sandberg <mischa_sandberg(at)telus(dot)net> writes:
> Quoting Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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,
> 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

> 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

In response to


pgsql-admin by date

Next:From: Mischa SandbergDate: 2008-11-18 19:06:50
Subject: Re: Reliably determining whether the server came up
Previous:From: Marcelo CostaDate: 2008-11-18 18:19:23
Subject: Re: Changing encoding

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group