#!/bin/bash PGINSTALL=~/install/postgres PGDATA=$PGINSTALL/pg_data echo "time segments usage_fraction usage_kb oldest_mxid next_mxid next_offset" while true ; do date="` date +%H:%M:%S `" segments="` ls $PGDATA/pg_multixact/members | wc -l | sed 's/^ *//' `" usage_fraction="` echo \"scale=4; $segments/82040\" | bc `" usage_kb="` du -sk $PGDATA/pg_multixact | cut -f1 `" oldest_mxid="` $PGINSTALL/bin/pg_controldata -D ~/install/postgres/pg_data | grep 'oldestMultiXid' | cut -d' ' -f6 `" next_mxid="` $PGINSTALL/bin/pg_controldata -D ~/install/postgres/pg_data | grep 'NextMultiXactId' | cut -d' ' -f5 `" next_offset="` $PGINSTALL/bin/pg_controldata -D ~/install/postgres/pg_data | grep 'NextMultiOffset' | cut -d' ' -f5 `" echo "$date $segments $usage_fraction $usage_kb $oldest_mxid $next_mxid $next_offset" sleep 60 done