Re: Question on start server using PG_CTL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mark Steben" <msteben(at)autorevenue(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Question on start server using PG_CTL
Date: 2009-08-03 15:49:56
Message-ID: 18222.1249314596@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Mark Steben" <msteben(at)autorevenue(dot)com> writes:
> Is it possible that, during startup, postmaster.pid takes a second or two to
> be created and hadn't been created yet when the test was run?

It's not instantaneous, for sure. For one thing, the kernel could be
scheduling the postmaster at lower priority than the continued execution
of your startup script. If you don't have any sleep at all in there
then the risk of failure would be quite high, even assuming the
postmaster would create the pidfile instantaneously once it gets to run.
And there are other things it has to do first, like read the config file
so it knows where the data directory is ...

Since you say you're using pg_ctl, why don't you use its -w option and
not let the script proceed until you know the postmaster is up?

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Brian Modra 2009-08-03 16:15:41 RAID for the DB filesystem
Previous Message Mark Steben 2009-08-03 15:31:10 Question on start server using PG_CTL