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