pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: How to check postgres running or not ?
Date: Sun, 19 Sep 2004 22:57:57 +0200
Message-ID: <414DF2D5.5040509@bigfoot.com> (raw)
In-Reply-To: <19430.1095611100@sss.pgh.pa.us>
References: <414A7395.8070503@vertex.co.in>
	<414CE76E.2050405@noggon.com>
	<414D7533.10708@3times25.net>
	<19430.1095611100@sss.pgh.pa.us>

Tom Lane wrote:
> Geoffrey <esoteric@3times25.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











view thread (22+ messages)  latest in thread

Message-ID: <414DF2D5.5040509@bigfoot.com>
Permalink:  ../414DF2D5.5040509@bigfoot.com/
Also on:    postgresql.org/message-id/414DF2D5.5040509@bigfoot.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mendola@bigfoot.com, tgl@sss.pgh.pa.us
  Subject: Re: How to check postgres running or not ?
  In-Reply-To: <414DF2D5.5040509@bigfoot.com>

* 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