2010-12-02 22:29:36 -08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
LIMIT=10000
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "usage: $0 [--limit <n>]"
|
2011-12-06 18:50:04 -08:00
|
|
|
exit 1
|
2010-12-02 22:29:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
--limit)
|
|
|
|
LIMIT=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*) usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
QUERY="WHERE NOT -NTOTAL = sum_array(nperdevice)"
|
|
|
|
|
2013-01-21 19:44:08 -08:00
|
|
|
echo -n "Device (pid) count: $(pidof xwords | wc | awk '{print $2}')"
|
|
|
|
echo "; relay pid[s]: $(pidof xwrelay)"
|
2010-12-02 22:29:36 -08:00
|
|
|
echo "Row count:" $(psql -t xwgames -c "select count(*) FROM games $QUERY;")
|
|
|
|
|
2013-01-21 19:44:08 -08:00
|
|
|
echo "SELECT dead,connname,cid,room,lang,clntVers as cv ,ntotal,nperdevice,seeds,addrs,tokens,devids,ack,nsent as snt "\
|
2010-12-02 22:29:36 -08:00
|
|
|
"FROM games $QUERY ORDER BY NOT dead, connname LIMIT $LIMIT;" \
|
|
|
|
| psql xwgames
|
|
|
|
|
2012-11-03 10:58:01 -07:00
|
|
|
echo "SELECT connname, hid, devid, count(*), sum(msglen) "\
|
2012-09-11 19:07:16 -07:00
|
|
|
"FROM msgs where connname in (SELECT connname from games where not games.dead group by connname)" \
|
2012-11-03 10:58:01 -07:00
|
|
|
"GROUP BY connname, hid, devid ORDER BY connname;" \
|
|
|
|
| psql xwgames
|
|
|
|
|
|
|
|
echo "SELECT * from devices;" \
|
2012-09-11 19:07:16 -07:00
|
|
|
| psql xwgames
|
|
|
|
|