Re: need to delete postmaster.pid file. automate it? - Mailing list pgsql-admin

From Tom Lane
Subject Re: need to delete postmaster.pid file. automate it?
Date
Msg-id 22351.1052195774@sss.pgh.pa.us
Whole thread Raw
In response to need to delete postmaster.pid file. automate it?  (mlaks <mlaks@bellatlantic.net>)
List pgsql-admin
mlaks <mlaks@bellatlantic.net> writes:
> I would like to automate this process of deleting postmaster.pid if
> postgresql is not running and would like to ask my question .

It is safe (and probably a good idea) to delete postmaster.pid in a
shell script that runs *ONLY DURING BOOTUP*.  Do *not* put such a
command into a script that you might run as a means of manually
restarting the postmaster --- because if you do, you just lost your
interlock against starting two postmasters for the same database.
Which, trust me, is not an interlock you want to lose.

There are quite a few other standard daemons, for instance sendmail,
that have similar issues with leftover lockfiles after a system
crash.  If you dig around in your boot scripts you may find one
that's already designed to remove unwanted lockfiles at system boot.
That'd be the place to add "rm /var/lib/pgsql/data/postmaster.pid".
But do not put it into anything that could be triggered after initial
system startup, unless you enjoy the sensation of shooting yourself
in the foot.

            regards, tom lane


pgsql-admin by date:

Previous
From: mlaks
Date:
Subject: need to delete postmaster.pid file. automate it?
Next
From: "shoaib"
Date:
Subject: Re: Database server restartig