Re: file-locking and postmaster.pid - Mailing list pgsql-hackers

From Andreas Joseph Krogh
Subject Re: file-locking and postmaster.pid
Date
Msg-id 200605241136.22497.andreak@officenet.no
Whole thread Raw
In response to Re: file-locking and postmaster.pid  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: file-locking and postmaster.pid
List pgsql-hackers
On Tuesday 23 May 2006 19:36, Tom Lane wrote:
> Adis Nezirovic <adis@linux.org.ba> writes:
> > Well, maybe you could tweak postgres startup script, add check for post
> > master (either 'pgrep postmaster' or 'ps -axu | grep [p]ostmaster'), and
> > delete pid file on negative results.
>
> This is exactly what you should NOT do.
>
> A start script that thinks it is smarter than the postmaster is almost
> certainly wrong.  It is certainly dangerous, too, because auto-deleting
> that pidfile destroys the interlock against having two postmasters
> running in the same data directory (which WILL corrupt your data,
> quickly and irretrievably).  All it takes to cause a problem is to
> use the start script to start a postmaster, forgetting that you already
> have one running ...

My PG is not started with startup-scripts, but with this command:

pg_ctl -D $PGDATA -l $PGDIR/log/logfile-`date +%Y-%m-%d`.log start

--
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / Manager
gpg public_key: http://dev.officenet.no/~andreak/public_key.asc
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Hoffsveien 17           | know how to do a thing and to watch         |
PO. Box 425 Skøyen      | somebody else doing it wrong, without       |
0213 Oslo               | comment.                                    |
NORWAY                  |                                             |
Phone : +47 22 13 01 00 |                                             |
Direct: +47 22 13 10 03 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+


pgsql-hackers by date:

Previous
From: sibel karaasma
Date:
Subject: compiling source code!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: file-locking and postmaster.pid