Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6DE0oa98941 for ; Fri, 13 Jul 2001 10:00:50 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f6DDiCo05194 for pgsql-admin@postgresql.org; Fri, 13 Jul 2001 09:44:12 -0400 (EDT) (envelope-from news) From: reina@nsi.edu (Tony Reina) X-Newsgroups: comp.databases.postgresql.admin Subject: Determining which users are logged onto the db Date: 12 Jul 2001 17:16:42 -0700 Organization: http://groups.google.com/ Lines: 20 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-support@google.com To: pgsql-admin@postgresql.org X-Archive-Number: 200107/53 X-Sequence-Number: 1804 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