Correction de legacy

This commit is contained in:
Adrien Bourmault 2021-11-18 14:24:53 +00:00
parent 02d7f670dc
commit 58a17409a0
1 changed files with 5 additions and 5 deletions

View File

@ -1,11 +1,11 @@
#! /bin/bash #! /bin/bash
STORAGE_DIR="/var/www/xmpp.chapril.org/upload/" STORAGE_DIR="/var/www/xmpp.chalec.org/upload/"
main() { main() {
echo "h2. ## Global info" echo "h2. ## Global info"
echo "" echo ""
echo "* Total accounts: $(sudo -u ejabberd ejabberdctl registered_users chapril.org | egrep -v -e 'r\.giskard' -e '(lisa|bart)\.simpson' | wc -l)" echo "* Total accounts: $(sudo -u ejabberd ejabberdctl registered_users chalec.org | egrep -v -e 'r\.giskard' -e '(lisa|bart)\.simpson' | wc -l)"
echo "** Active: $(count_active_accounts)" echo "** Active: $(count_active_accounts)"
echo "** Inactive: $(count_inactive_accounts '1 MONTH')" echo "** Inactive: $(count_inactive_accounts '1 MONTH')"
echo "** Removable: $(count_removable_accounts '6 MONTHS')" echo "** Removable: $(count_removable_accounts '6 MONTHS')"
@ -92,7 +92,7 @@ count_removable_accounts() {
join users u on l.username = u.username join users u on l.username = u.username
join spool s on l.username = s.username join spool s on l.username = s.username
where to_timestamp(cast(l.seconds as int)) < current_timestamp - interval '${since}' where to_timestamp(cast(l.seconds as int)) < current_timestamp - interval '${since}'
and s.xml like '%from=''chapril.org'' xmlns=''jabber:client''%Bienvenue sur le serveur%' and s.xml like '%from=''chalec.org'' xmlns=''jabber:client''%Bienvenue sur le serveur%'
and s.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" and s.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
@ -135,7 +135,7 @@ count_biboumi_active_external_users() {
from muclogline_ as m2 from muclogline_ as m2
where m2.owner_ = m1.owner_ ) ) as m0 where m2.owner_ = m1.owner_ ) ) as m0
where to_timestamp(m0.date_) > current_timestamp - interval '${since}' where to_timestamp(m0.date_) > current_timestamp - interval '${since}'
and m0.owner_ not like '%chapril.org%'" and m0.owner_ not like '%chalec.org%'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
@ -166,7 +166,7 @@ count_biboumi_inactive_external_users() {
from muclogline_ as m2 from muclogline_ as m2
where m2.owner_ = m1.owner_ ) ) as m0 where m2.owner_ = m1.owner_ ) ) as m0
where to_timestamp(m0.date_) < current_timestamp - interval '${since}' where to_timestamp(m0.date_) < current_timestamp - interval '${since}'
and m0.owner_ not like '%chapril.org%'" and m0.owner_ not like '%chalec.org%'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }