need to delete postmaster.pid file. automate it?

Поиск
Список
Период
Сортировка
От mlaks
Тема need to delete postmaster.pid file. automate it?
Дата
Msg-id 200305052327.45943.mlaks@bellatlantic.net
обсуждение исходный текст
Ответы Re: need to delete postmaster.pid file. automate it?
Список pgsql-admin
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


В списке pgsql-admin по дате отправления:

Предыдущее
От: "Sidar Lopez Cruz"
Дата:
Сообщение: News in 7.4
Следующее
От: Tom Lane
Дата:
Сообщение: Re: need to delete postmaster.pid file. automate it?