From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Michael B. Babakov <M.Babakov@sochi.net.ru>
Cc: pgsql-admin@postgresql.org
Subject: Re: users work now with PostgreSQL
Date: Tue, 12 Dec 2000 10:50:26 -0600
Message-ID: <20001212105026.B25559@rice.edu> (raw)
In-Reply-To: <3A3492A5.F88CAE53@sochi.net.ru>
References: <3A3492A5.F88CAE53@sochi.net.ru>
It's encoded in the process environment, so the 'ps' command will
give you what you want:
On my Debian linux box, I do something like:
reedstrm@cooker:~$ ps ax | grep '[/]postgres '
18737 ? S 0:02 /usr/lib/postgresql/bin/postmaster -b /usr/lib/postgresql/bin/postgres -B 128 -D /var/lib/postgres/data -d 2 -i -o -E
8696 ? S 0:00 /usr/lib/postgresql/bin/postgres localhost reedstrm reedstrm idle
8697 ? S 0:00 /usr/lib/postgresql/bin/postgres 192.168.1.190 reedstrm idas idle
reedstrm@cooker:~$
This shows you the postmaster, and two clients connected: Both are
user 'reedstrm' one is connected to database 'reedstrm' and is a local
conenction, the other to 'idas' from a remote machine (I faked the IP).
Both are currently idle.
The odd form of the grep argument is just to filter out the psql client,
and the grep process itself. If you want something completely automated,
say to use in a script of some sort, I'd go with (note that the exact
syntax depends on your version of unix):
reedstrm@cooker:~$ ps ax | grep '[/]usr/lib/postgresql/bin/postgres' |
grep -v postmaster | awk '{print $6,$7,$8,$9}'
localhost reedstrm reedstrm idle
192.168.1.190 reedstrm idas idle
Ross
On Mon, Dec 11, 2000 at 11:39:01AM +0300, Michael B. Babakov wrote:
> Good day!
>
> How to look what users work now with PostgreSQL?
>
--
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers
and users independent of economic motivations. Jim Flynn, Sunnyvale, Calif.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: reedstrm@rice.edu, M.Babakov@sochi.net.ru
Subject: Re: users work now with PostgreSQL
In-Reply-To: <20001212105026.B25559@rice.edu>
References: <3A3492A5.F88CAE53@sochi.net.ru> <20001212105026.B25559@rice.edu>
* 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