Determining which users are logged onto the db

Поиск
Список
Период
Сортировка
От reina@nsi.edu (Tony Reina)
Тема Determining which users are logged onto the db
Дата
Msg-id f40d3195.0107121616.13a0a9fb@posting.google.com
обсуждение исходный текст
Список 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

В списке pgsql-admin по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Dump from Postgresql95
Следующее
От: Ricardo Maia
Дата:
Сообщение: Error accessing PostgreSQL