synapse/cmd.sh: add description comment
authorPeter Gervai <grin@grin.hu>
Fri, 21 Jan 2022 10:22:11 +0100
changeset 3 99e6c1cdae3b
parent 2 c3f49b58aff6
child 4 721d4af9fdd7
synapse/cmd.sh: add description comment Add unique 1 day list help
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 <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