diff --git a/rapport_activite/rapport_activites.sh b/rapport_activite/rapport_activites.sh index 973e85e..212258a 100755 --- a/rapport_activite/rapport_activites.sh +++ b/rapport_activite/rapport_activites.sh @@ -69,7 +69,7 @@ count_active_accounts() { where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${since}' and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" - psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_inactive_accounts() { @@ -80,7 +80,7 @@ count_inactive_accounts() { where to_timestamp(cast(l.seconds as int)) < current_timestamp - interval '${since}' and l.username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" - psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } @@ -95,18 +95,18 @@ count_removable_accounts() { 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')" - psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -u ejabberd psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_archived_messages() { - sudo -Hiu postgres psql ejabberd -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql ejabberd -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_users() { sql="select count(distinct owner_) from muclogline_" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_active_users() { @@ -121,7 +121,7 @@ count_biboumi_active_users() { where m2.owner_ = m1.owner_ ) ) as m0 where to_timestamp(m0.date_) > current_timestamp - interval '${since}'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_active_external_users() { @@ -137,7 +137,7 @@ count_biboumi_active_external_users() { where to_timestamp(m0.date_) > current_timestamp - interval '${since}' and m0.owner_ not like '%chalec.org%'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_inactive_users() { @@ -152,7 +152,7 @@ count_biboumi_inactive_users() { where m2.owner_ = m1.owner_ ) ) as m0 where to_timestamp(m0.date_) < current_timestamp - interval '${since}'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_inactive_external_users() { @@ -168,7 +168,7 @@ count_biboumi_inactive_external_users() { where to_timestamp(m0.date_) < current_timestamp - interval '${since}' and m0.owner_ not like '%chalec.org%'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_archived_messages() { @@ -176,7 +176,7 @@ count_biboumi_archived_messages() { sql="select count(body_) from muclogline_" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_active_servers() { @@ -185,7 +185,7 @@ count_biboumi_active_servers() { from muclogline_ where to_timestamp(date_) > current_timestamp - interval '${since}'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } count_biboumi_active_chan() { @@ -194,7 +194,7 @@ count_biboumi_active_chan() { from muclogline_ where to_timestamp(date_) > current_timestamp - interval '${since}'" - sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' + sudo -Hiu postgres sudo -u ejabberd psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}' } get_last_month() {