X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 90004476178 for ; Mon, 5 May 2003 23:53:05 -0400 (EDT) Received: from out001.verizon.net (out001pub.verizon.net [206.46.170.140]) by postgresql.org (Postfix) with ESMTP id E51B2475AE4 for ; Mon, 5 May 2003 23:53:04 -0400 (EDT) Received: from RavChaim ([162.84.164.178]) by out001.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030506035309.XFCO12592.out001.verizon.net@RavChaim> for ; Mon, 5 May 2003 22:53:09 -0500 Content-Type: text/plain; charset="us-ascii" From: mlaks To: pgsql-admin@postgresql.org Subject: need to delete postmaster.pid file. automate it? Date: Mon, 5 May 2003 23:27:45 -0400 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305052327.45943.mlaks@bellatlantic.net> X-Authentication-Info: Submitted using SMTP AUTH at out001.verizon.net from [162.84.164.178] at Mon, 5 May 2003 22:53:09 -0500 X-Spam-Status: No, hits=-11.7 required=5.0 tests=BAYES_10,RCVD_IN_OSIRUSOFT_COM,USER_AGENT_KMAIL 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/52 X-Sequence-Number: 8614 Hii!=20 I am using Postgresql 7.2.1 on Redhat Linux 7.3 as the database that suppo= rts=20 another application. At bootup, the other application checks whether or not= =20 Postgresql is running and if Postgresql is not running, it fails.=20 The system has been quite stable and has run for almost nonstop for many=20 months.=20 However, ocassionally something goes wrong and the application fails becaus= e=20 Postgresql goes down. I believe it is usually when the there is a power sur= ge=20 in the Hospital where these machines reside. This application failure seems= =20 to be due to an improper shutdown of Postgresql. Sometimes when the databa= se=20 backed application fails it can be restarted by simply rebooting the machin= e.=20 Postgresql gets restarted and then the application can get started during= =20 normal bootup. However, sometimes Postgresql won't start. When I intervene manually, and= =20 attempt to run pg_ctl stop, I get an error that there is not any postgresq= l=20 process, and then when I run pg_ctl start, the message says something about= =20 memory being reserved (I don't really remember the exact message- but=20 whatever - Postgresql nicely tells me to proceed to delete the file=20 /var/lib/pgsql/data/ostmaster.pid.=20 I do that and then all is fine. I can then restart Postgresql with pg_ctl= =20 start and then the application needing Postgresql starts nicely. I would like to automate this process of deleting postmaster.pid if postgre= sql=20 is not running and would like to ask my question .=20 What risk is there in automating the process (say via perl or shell script)= .=20 Also advice on how to do it. So I would start my application, if that fails, check if postgresql is runn= ing=20 (? perhaps with ps -aux|grep postgresql ) then restart postgresql, check fo= r=20 an error, and if that fails, delete postmaster.pid and restart pg_ctl start= ,=20 and then start up the database backed application.=20=20 Are there any pitfalls that I am not aware of? Thank you, Mitchell Laks