mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
script for use on relay host
This commit is contained in:
parent
77fe3952da
commit
b65338b643
1 changed files with 27 additions and 0 deletions
27
xwords4/relay/scripts/showrecent.sh
Executable file
27
xwords4/relay/scripts/showrecent.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e -u
|
||||
|
||||
LIMIT=10000
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 [--limit <n>]"
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--limit)
|
||||
LIMIT=$2
|
||||
shift
|
||||
;;
|
||||
*) usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
QUERY="WHERE NOT -NTOTAL = sum_array(nperdevice)"
|
||||
COLUMNS=" dead, connname,cid,room,pub, lang, ntotal, nperdevice, nsent,ctime,mtimes"
|
||||
COLUMNS_AS="dead as D,connname,cid,room,pub as P,lang as L,ntotal as n,nperdevice as nper,nsent,ctime,mtimes"
|
||||
|
||||
echo "SELECT $COLUMNS_AS FROM ( SELECT $COLUMNS, unnest(mtimes) FROM games $QUERY) AS set GROUP BY $COLUMNS ORDER BY max(unnest) DESC LIMIT $LIMIT;" | psql xwgames
|
Loading…
Reference in a new issue