Re: need to delete postmaster.pid file. automate it?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mlaks <mlaks(at)bellatlantic(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: need to delete postmaster.pid file. automate it?
Date: 2003-05-06 04:36:14
Message-ID: 22351.1052195774@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

mlaks <mlaks(at)bellatlantic(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message shoaib 2003-05-06 05:40:54 Re: Database server restartig
Previous Message mlaks 2003-05-06 03:27:45 need to delete postmaster.pid file. automate it?