pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: mlaks <mlaks@bellatlantic.net>
To: pgsql-admin@postgresql.org
Subject: need to delete postmaster.pid file. automate it?
Date: Mon, 5 May 2003 23:27:45 -0400
Message-ID: <200305052327.45943.mlaks@bellatlantic.net> (raw)

Hii! 
I am using Postgresql 7.2.1 on Redhat Linux 7.3  as the database that supports 
another application. At bootup, the other application checks whether or not 
Postgresql is running and if Postgresql is not running, it fails. 

The system has been quite stable and has run for almost nonstop for many 
months. 

However, ocassionally something goes wrong and the application fails because 
Postgresql goes down. I believe it is usually when the there is a power surge 
in the Hospital where these machines reside. This application failure seems 
to be due to an improper shutdown of Postgresql. Sometimes when the  database 
backed application fails it can be restarted by simply rebooting the machine. 
Postgresql gets restarted and then the application can get started during 
normal bootup.

However, sometimes Postgresql won't start. When I intervene manually, and 
attempt to run pg_ctl stop,  I get an error that there is not any postgresql 
process, and then when I run pg_ctl start, the message says something about 
memory being reserved (I don't really remember the exact message- but 
whatever - Postgresql  nicely tells me to proceed to delete the file 
/var/lib/pgsql/data/ostmaster.pid. 
I do that and then all is fine. I can then restart Postgresql with pg_ctl 
start and then the application needing Postgresql starts nicely.

I would like to automate this process of deleting postmaster.pid if postgresql 
is not running and would like to ask my question
. 
What risk is there in automating the process (say via perl or shell script). 
Also advice on how to do it.

So I would start my application, if that fails, check if postgresql is running 
(? perhaps with ps -aux|grep postgresql ) then restart postgresql, check for 
an error, and if that fails, delete postmaster.pid and restart pg_ctl start, 
and then start up the database backed application.  

Are there any pitfalls that I am not aware of?

Thank you,

Mitchell Laks




view thread (2+ messages)  latest in thread

Message-ID: <200305052327.45943.mlaks@bellatlantic.net>
Permalink:  ../200305052327.45943.mlaks@bellatlantic.net/
Also on:    postgresql.org/message-id/200305052327.45943.mlaks@bellatlantic.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mlaks@bellatlantic.net
  Subject: Re: need to delete postmaster.pid file. automate it?
  In-Reply-To: <200305052327.45943.mlaks@bellatlantic.net>
  References: <200305052327.45943.mlaks@bellatlantic.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox