#!/bin/sh # 8.4 #psql -p 5432 -c "select * from pg_stat_activity where current_query != '';" template1 # 9.x psql -p 6543 -c "select * from pg_stat_activity where state != 'idle';" template1