Re: getting pid of backend

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: getting pid of backend
Date: 2002-03-05 23:34:56
Message-ID: 200203052334.g25NYu403277@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kovacs Zoltan wrote:
> On Tue, 5 Mar 2002, Josh Berkus wrote:
>
> > Kovacs,
> >
> > > Is there an easier method?
> >
> > Much easier. Take a look at $PGDATA/postmaster.pid
>
> I mean the current pid number of the actual connection. Not the postmaster
> process, I need the pid of the currently running postgres. :-)

You are going to love this one:

test=> create function getpid() returns int as '/shlib/libc.so',
'getpid' language c;
CREATE
test=> select getpid();
getpid
--------
2971
(1 row)

You may need to modify the libc.so path.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-03-05 23:37:23 Re: getting pid of backend
Previous Message Kovacs Zoltan 2002-03-05 22:49:55 Re: getting pid of backend