xwords/xwords4/relay/scripts/showinplay.sh
Eric House 7fec736947 add udp socket and protocol for use over it so that a device can
manage a single connection to the relay for all of its games.  Works
so far to the extent that the game's playable with all boards on the
same device (with checkins about to come) as long as all boards are
open.  (Client doesn't handle opening closed games yet.)
2013-01-15 18:41:17 -08:00

40 lines
940 B
Bash
Executable file

#!/bin/sh
set -e -u
LIMIT=10000
usage() {
echo "usage: $0 [--limit <n>]"
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
--limit)
LIMIT=$2
shift
;;
*) usage
;;
esac
shift
done
QUERY="WHERE NOT -NTOTAL = sum_array(nperdevice)"
echo "Device (pid) count: $(pidof xwords | wc | awk '{print $2}')"
echo "Row count:" $(psql -t xwgames -c "select count(*) FROM games $QUERY;")
echo "SELECT dead,connname,cid,room,lang,clntVers,ntotal,nperdevice,seeds,addrs,tokens,ack,nsent "\
"FROM games $QUERY ORDER BY NOT dead, connname LIMIT $LIMIT;" \
| psql xwgames
echo "SELECT connname, hid, devid, count(*), sum(msglen) "\
"FROM msgs where connname in (SELECT connname from games where not games.dead group by connname)" \
"GROUP BY connname, hid, devid ORDER BY connname;" \
| psql xwgames
echo "SELECT * from devices;" \
| psql xwgames