Re: Number of Connections - Mailing list pgsql-general

From Tom Lane
Subject Re: Number of Connections
Date
Msg-id 13807.982358637@sss.pgh.pa.us
Whole thread Raw
In response to Re: Number of Connections  (Neil Conway <nconway@klamath.dyndns.org>)
List pgsql-general
Neil Conway <nconway@klamath.dyndns.org> writes:
> On Fri, Feb 16, 2001 at 02:09:42PM -0500, Bryan White wrote:
>> ps ax | grep postgres | wc -l
>> Note the value is often one to high because is picks up the grep process.

> Why not just remove 'grep' - i.e
> ps ax | grep postgres | grep -v grep | wc -l

Actually this is a standard problem with a standard solution: use a
not-so-literal grep pattern, eg

    ps ax | grep '[p]ostgres' | wc -l

This pattern matches 'postgres' but not '[p]ostgres'.  Problem solved.

            regards, tom lane

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Question
Next
From: "Tim Barnard"
Date:
Subject: Re: Number of Connections