--- 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 <mode> <args> ...."
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 [<n>] - last <n> (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