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 40EDC329CDB for ; Mon, 20 Sep 2004 13:19:42 +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 20287-04 for ; Mon, 20 Sep 2004 12:19:34 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 1E9E1329CB0 for ; Mon, 20 Sep 2004 13:19:31 +0100 (BST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i8KCJRp05291; Mon, 20 Sep 2004 08:19:27 -0400 (EDT) From: Bruce Momjian Message-Id: <200409201219.i8KCJRp05291@candle.pha.pa.us> Subject: Re: How to check postgres running or not ? In-Reply-To: <19876.1095613927@sss.pgh.pa.us> To: Tom Lane Date: Mon, 20 Sep 2004 08:19:27 -0400 (EDT) Cc: Andrew Sullivan , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII 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/156 X-Sequence-Number: 19002 Tom Lane wrote: > At one time there was discussion of writing a "pg_ping" utility program > to do exactly this, but it still hasn't got done. You can fake it to > some extent by just running "psql -l >/dev/null" and checking the exit > code, but this does require supplying a valid username and possibly a > password (because psql's exit code doesn't distinguish "could not > connect" from authentication errors). > > BTW, "pg_ctl status" doesn't answer this need because it only looks for > a postmaster.pid file, it doesn't attempt to verify that the postmaster > is really alive. Is improving this a TODO item for pg_ctl? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073