X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3C3A1476459 for ; Tue, 6 May 2003 00:36:11 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 73BBF47641F for ; Tue, 6 May 2003 00:36:10 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h464aFU6022352; Tue, 6 May 2003 00:36:15 -0400 (EDT) To: mlaks Cc: pgsql-admin@postgresql.org Subject: Re: need to delete postmaster.pid file. automate it? In-reply-to: <200305052327.45943.mlaks@bellatlantic.net> References: <200305052327.45943.mlaks@bellatlantic.net> Comments: In-reply-to mlaks message dated "Mon, 05 May 2003 23:27:45 -0400" Date: Tue, 06 May 2003 00:36:14 -0400 Message-ID: <22351.1052195774@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/53 X-Sequence-Number: 8615 mlaks 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