Re: [HACKERS] postmaster.pid

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: pgsql-hackers@postgreSQL.org
Date: 1999-12-03T08:38:02Z
Lists: pgsql-hackers
> > > 2) if it fails to create pid file, call
> > > ExitPostmaster(1). ExitPostmaster calls proc_exit() and proc_exit
> > > calls exit().
> > 
> > So you don't start if the pid file is there,
> 
> Right.
> 
> >or do you delete it if the
> > port is free?
> 
> No. even if the port is free, there might be another postmaster that
> uses another one.
> 
> Wait, maybe I can check postmaster.opts to see if another postamster
> really exists...

You can do kill(0) on the pid to see if it is actually a real pid. 
Rather than playing with the port, just check the pid because the
postmaster could be startup up by not on the port yet.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026