# HG changeset patch # User Peter Gervai # Date 1642756931 -3600 # Node ID 99e6c1cdae3bdfc220166d1731b9f3b6917c2b07 # Parent c3f49b58aff6f41110a1f374015bd1c8783168dc synapse/cmd.sh: add description comment Add unique 1 day list help diff -r c3f49b58aff6 -r 99e6c1cdae3b synapse/cmd.sh --- a/synapse/cmd.sh Fri Jan 21 10:10:19 2022 +0100 +++ b/synapse/cmd.sh Fri Jan 21 10:22:11 2022 +0100 @@ -1,7 +1,13 @@ #!/bin/bash #$Id: cmd.sh,v 7c8632f2b6be 2022/01/21 09:05:10 grin $ # +# This program queries PostgreSQL directly for various user statistics. +# Set psql access below (CMD=...), ensure that .pgpass lets user to login +# without password entry. +# Start without arguments for help. +# # (c)Peter Gervai, 2020-21 +# @grin:grin.hu # Licensed under GPLv3+ and CC_By-Sa-4.0-int # @@ -15,7 +21,8 @@ echo "Usage: $0 ...." echo " modes: user @someuser:grin.hu - user stats" echo " userevents @someuser:grin.hu - user events" - echo " active1 - last 1 day active users" + echo " active1 - last 1 day active users timeline" + echo " active1u - last 1 day users (unique results)" echo " lastreg [] - last (25) registrations" exit fi @@ -96,11 +103,11 @@ if [ "$MODE" = "active1u" ]; then $CMD "SELECT DISTINCT user_id FROM user_ips WHERE unts(last_seen)> NOW()-'1 day'::interval - ORDER BY 1" + ORDER BY 1" | cat $CMD "SELECT DISTINCT user_id,device_id,ip FROM user_ips WHERE unts(last_seen)> NOW()-'1 day'::interval - ORDER BY 1" + ORDER BY 1" | cat exit fi