author | Peter Gervai <grin@grin.hu> |
Wed, 02 Mar 2022 14:50:37 +0100 | |
changeset 7 | 6aea45bf033b |
parent 3 | 99e6c1cdae3b |
child 8 | b92f5cceab78 |
permissions | -rwxr-xr-x |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
1 |
#!/bin/bash |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
2 |
#$Id: cmd.sh,v 728762bf2e91 2022/03/02 13:38:25 grin $ |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
3 |
# |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
4 |
# |
3
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
5 |
# This program queries PostgreSQL directly for various user statistics. |
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
6 |
# Set psql access below (CMD=...), ensure that .pgpass lets user to login |
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
7 |
# without password entry. |
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
8 |
# Start without arguments for help. |
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
9 |
# |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
10 |
# (c)Peter Gervai, 2020-22 |
3
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
11 |
# @grin:grin.hu |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
12 |
# Licensed under GPLv3+ and CC_By-Sa-4.0-int |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
13 |
# |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
14 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
15 |
#CMD='sudo -u postgres psql synapse -tAc' |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
16 |
#CMD='psql -h 1.2.3.4 -U synapse synapse -c' |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
17 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
18 |
. ./_config.sh |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
19 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
20 |
CMD="${PSQL_CMD}" |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
21 |
CMDQ='-At' |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
22 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
23 |
MODE="$1" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
24 |
ARG="$2" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
25 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
26 |
if [ "x$MODE" = "x" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
27 |
echo "Usage: $0 <mode> <args> ...." |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
28 |
echo " modes: user @someuser:grin.hu - user stats" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
29 |
echo " userevents @someuser:grin.hu - user events" |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
30 |
echo " active1 - last 1 day active users" |
3
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
31 |
echo " active1u - last 1 day users (unique results)" |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
32 |
echo " lastreg [<n>] - last <n> (25) registrations" |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
33 |
echo " room <room_id without !> - room info" |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
34 |
echo " evt <event_id w/o $> - event info" |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
35 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
36 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
37 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
38 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
39 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
40 |
egy_arg() { |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
41 |
local s=$1 |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
42 |
if [ "x$ARG" = "x" ]; then |
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
43 |
echo "MIssing arg ${s}!" |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
44 |
echo "$0 $MODE $s" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
45 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
46 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
47 |
} |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
48 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
49 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
50 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
51 |
if [ "$MODE" = "user" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
52 |
egy_arg 'user' |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
53 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
54 |
echo "=== User data ===" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
55 |
$CMD "SELECT display_name FROM user_directory WHERE user_id='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
56 |
$CMD "SELECT medium, address, unts(validated_at) AS validated_at, unts(added_at) AS added_at FROM user_threepids WHERE user_id='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
57 |
$CMD "SELECT joined_rooms FROM user_stats_current WHERE user_id='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
58 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
59 |
echo "=== Logins ===" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
60 |
$CMD "SELECT user_id,device_id,ip,unts(last_seen) AS last_seen,user_agent FROM user_ips WHERE user_id='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
61 |
$CMD "SELECT device_id, user_agent, unts(timestamp) FROM user_daily_visits WHERE user_id='$ARG' ORDER BY 1 ASC, 3 DESC LIMIT 10" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
62 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
63 |
echo "=== Shared private rooms ===" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
64 |
$CMD "select * from users_who_share_private_rooms where user_id='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
65 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
66 |
echo "=== Rooms the user has been ===" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
67 |
$CMD "SELECT rm.room_id, rm.event_id, rm.sender, rm.membership, |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
68 |
rss.canonical_alias, rss.join_rules, rss.encryption, |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
69 |
unts(e.origin_server_ts), rss.name |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
70 |
FROM room_memberships rm |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
71 |
JOIN room_stats_state rss USING(room_id) |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
72 |
JOIN events e USING(event_id) |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
73 |
WHERE user_id='$ARG' |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
74 |
ORDER BY e.origin_server_ts" | more |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
75 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
76 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
77 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
78 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
79 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
80 |
if [ "$MODE" = "userevents" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
81 |
egy_arg 'user' |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
82 |
$CMD "SELECT * FROM events WHERE sender='@sztg:grin.hu'; |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
83 |
SELECT stream_ordering,type,e.room_id,content,sender,unts(origin_server_ts) AS orig_s,json |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
84 |
FROM events e LEFT JOIN event_json j USING(event_id) |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
85 |
WHERE sender='$ARG'" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
86 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
87 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
88 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
89 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
90 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
91 |
if [ "$MODE" = "active1" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
92 |
$CMD "SELECT user_id,device_id,ip,unts(MAX(last_seen)) AS last_seen,user_agent FROM user_ips |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
93 |
WHERE unts(last_seen)> NOW()-'1 day'::interval |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
94 |
GROUP BY 1,2,3,5 |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
95 |
ORDER BY last_seen DESC" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
96 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
97 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
98 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
99 |
if [ "$MODE" = "lastreg" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
100 |
if [ "x$ARG" = "x" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
101 |
ARG=25 |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
102 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
103 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
104 |
$CMD "SELECT name,unts(creation_ts*1000) AS created,is_guest,deactivated,shadow_banned, |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
105 |
device_id,ip,unts(last_seen) AS last_seen, user_agent |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
106 |
FROM users LEFT JOIN user_ips ON(name=user_id) |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
107 |
ORDER BY 2 DESC |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
108 |
LIMIT $ARG" |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
109 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
110 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
111 |
if [ "$MODE" = "active1u" ]; then |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
112 |
$CMD "SELECT DISTINCT user_id FROM user_ips |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
113 |
WHERE unts(last_seen)> NOW()-'1 day'::interval |
3
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
114 |
ORDER BY 1" | cat |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
115 |
|
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
116 |
$CMD "SELECT DISTINCT user_id,device_id,ip FROM user_ips |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
117 |
WHERE unts(last_seen)> NOW()-'1 day'::interval |
3
99e6c1cdae3b
synapse/cmd.sh: add description comment
Peter Gervai <grin@grin.hu>
parents:
2
diff
changeset
|
118 |
ORDER BY 1" | cat |
2
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
119 |
exit |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
120 |
fi |
c3f49b58aff6
Add synapse/cmd.sh: query db for various user statistics
Peter Gervai <grin@grin.hu>
parents:
diff
changeset
|
121 |
|
7
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
122 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
123 |
if [ "$MODE" = "room" ]; then |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
124 |
$CMD "SELECT rs.name, rs.canonical_alias,rs.join_rules,rs.topic FROM room_stats_state rs WHERE room_id='!${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
125 |
$CMD "SELECT room_alias, creator FROM room_aliases WHERE room_id='!${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
126 |
$CMD "SELECT * FROM rooms WHERE room_id='!${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
127 |
$CMD "SELECT * FROM room_stats_current WHERE room_id='!${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
128 |
# $CMD "SELECT COUNT(*), type FROM state_groups_state WHERE room_id='!${ARG}' GROUP BY 2 ORDER BY 1 DESC" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
129 |
fi |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
130 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
131 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
132 |
if [ "$MODE" = "evt" ]; then |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
133 |
$CMD "SELECT event_id,type,room_id,content,processed,depth,sender,instance_name,state_key,unts(origin_server_ts) AS orig, unts(received_ts) AS rcv FROM events WHERE event_id='\$${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
134 |
$CMD "SELECT * FROM event_json WHERE event_id='\$${ARG}'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
135 |
evt='$'"${ARG}" |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
136 |
room=`$CMD "SELECT room_id FROM events WHERE event_id='${evt}'" $CMDQ` |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
137 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
138 |
#echo "Room_id=$room!" |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
139 |
$CMD "SELECT rs.name, rs.canonical_alias,rs.join_rules,rs.topic FROM room_stats_state rs WHERE room_id='$room'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
140 |
$CMD "SELECT room_alias, creator FROM room_aliases WHERE room_id='$room'" | cat |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
141 |
|
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
142 |
fi |
6aea45bf033b
Add room and event display to cmd.sh
Peter Gervai <grin@grin.hu>
parents:
3
diff
changeset
|
143 |