X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 509BE329E6B for ; Sun, 19 Sep 2004 22:14:03 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11239-07 for ; Sun, 19 Sep 2004 21:13:57 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7B344329CD2 for ; Sun, 19 Sep 2004 22:13:57 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i8JLDrfi013960 for ; Sun, 19 Sep 2004 21:13:54 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i8JKw0NA010107 for pgsql-sql@postgresql.org; Sun, 19 Sep 2004 20:58:00 GMT From: Gaetano Mendola X-Newsgroups: comp.databases.postgresql.sql Subject: Re: How to check postgres running or not ? Date: Sun, 19 Sep 2004 22:57:57 +0200 Organization: PYRENET Midi-pyrenees Provider Lines: 45 Message-ID: <414DF2D5.5040509@bigfoot.com> References: <414A7395.8070503@vertex.co.in> <414CE76E.2050405@noggon.com> <414D7533.10708@3times25.net> <19430.1095611100@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Tom Lane User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en In-Reply-To: <19430.1095611100@sss.pgh.pa.us> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/143 X-Sequence-Number: 18989 Tom Lane wrote: > Geoffrey 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