Peter Eisentraut <peter_e@gmx.net> writes:
> Baldur Norddahl wrote:
>> Is there a better way to query the status of postgresql? I would
>> expect it to at least check that the process in the PID is actually
>> running and that it is a postgresql process.
> Maybe try
> test $(readlink /proc/$pid/exe) = /usr/bin/postgres
I think the question stands though: why doesn't pg_ctl check that the
PID in the lockfile corresponds to a live process? A quick kill(pid,0)
would raise the robustness of the status check quite a lot, and now that
the code is in C it's a trivial addition.
Unless someone sees a reason not to do this, I will throw the change
into current and 8.0 branches.
regards, tom lane