Re: How to check postgres running or not ?

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: How to check postgres running or not ?
Date: 2004-09-19 20:57:57
Message-ID: 414DF2D5.5040509@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
> Geoffrey <esoteric(at)3times25(dot)net> writes:
>
>>Worik wrote:
>>
>>>Assuming it is unix.... The command
>>>ps xau|grep post
>
>
>>You might want to change that to:
>>ps aux|grep postgres
>>As your suggestion will pick up extraneous data if one is running
>>postfix on the same box.
>
>
> Actually I'd recommend grepping for "postmaster". If your PG user is
> named "postgres" then the above command will find any program the PG
> user is running --- which might only be a shell, for instance. If your
> PG user is not named "postgres" then the above might find nothing at
> all, even though the postmaster is alive (since depending on the details
> of your local ps command, it might report all the server processes as
> "postmaster").
>
> There is even another gotcha, which is that the "grep postmaster"
> command could easily find itself in the ps output. So what really
> works is
> ps aux | grep postmaster | grep -v grep
> (or use "ps -ef" if using a SysV-ish ps).

Just to enforce the test is better looking for the entire executable path:

ps aux | grep /usr/bin/postmaster | grep -v grep

Regards
Gaetano Mendola

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gaetano Mendola 2004-09-19 21:01:01 Re: How to check postgres running or not ?
Previous Message T E Schmitz 2004-09-19 20:50:00 Re: ORDER BY and NULLs