Determining which users are logged onto the db

From: reina(at)nsi(dot)edu (Tony Reina)
To: pgsql-admin(at)postgresql(dot)org
Subject: Determining which users are logged onto the db
Date: 2001-07-13 00:16:42
Message-ID: f40d3195.0107121616.13a0a9fb@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have a few shell scripts that run when I log into the Postgres
administrator account on my db (i.e. user = 'postgres'). I'd like to
find a simple way to also list from the shell script which users are
currently querying the db.

I know I can see the db backends by using:

database > ps ax | grep post

1215 ? S 0:00 /database/local/pgsql/bin/postmaster -D
/database/loc
1381 pts/0 S 0:00 login -- postgres
1412 ? S 0:00 postgres: reina db01 xxx.xxx.xxx.xxx idle
1413 ? S 0:00 postgres: abs db01 xxx.xxx.xxx.xxx idle
1414 ? S 0:00 postgres: reina db01 xxx.xxx.xxx.xxx idle

Is there a way that I can parse out the user names 'reina' and 'abs'?
Perhaps a sed command?

-Tony

Browse pgsql-admin by date

  From Date Subject
Next Message Adam Manock 2001-07-13 00:32:10 Re: Performance tuning for linux, 1GB RAM, dual CPU?
Previous Message Bruce Momjian 2001-07-12 20:07:29 Re: Dump from Postgresql95