Compare commits

...

3 Commits

Author SHA1 Message Date
584cd84b95
rapport d'activité: le rapport généré n'est pas du JSON
Corrige #6265
2024-06-16 18:46:25 +02:00
3c40a12635
rapport d'activités: correction du format (textile)
ne pas barrer le texte "instance mineclone2"
2024-06-16 18:46:22 +02:00
baa09328c4
rapport activité: suppression des warnings
Supprime ces warnings:

    could not change directory to "/root": Permission non accordée
2024-06-16 18:46:20 +02:00
2 changed files with 9 additions and 18 deletions

View File

@ -58,7 +58,7 @@ generateReport()
deadCount=$(zgrep " died at " /var/log/minetest/30009-mineclone2.log-${month}* | wc -l) deadCount=$(zgrep " died at " /var/log/minetest/30009-mineclone2.log-${month}* | wc -l)
echo "Nombre de morts = $deadCount" echo "Nombre de morts = $deadCount"
accountTotalCount=$(su -c "psql -U postgres -d minetest-auth --tuples-only -c \"SELECT COUNT(*) FROM auth\"" postgres | xargs 2> /dev/null) accountTotalCount=$(su -l -c "psql -U postgres -d minetest-auth --tuples-only -c \"SELECT COUNT(*) FROM auth\"" postgres | xargs 2> /dev/null)
echo "Nombre de comptes total = $accountTotalCount" echo "Nombre de comptes total = $accountTotalCount"
warningCount=$(zgrep "WARNING" /var/log/minetest/30009-mineclone2.log-${month}* | wc -l) warningCount=$(zgrep "WARNING" /var/log/minetest/30009-mineclone2.log-${month}* | wc -l)
@ -67,7 +67,7 @@ generateReport()
errorCount=$(zgrep "ERROR" /var/log/minetest/30009-mineclone2.log-${month}* | wc -l) errorCount=$(zgrep "ERROR" /var/log/minetest/30009-mineclone2.log-${month}* | wc -l)
echo "Nombre d'erreurs = $errorCount" echo "Nombre d'erreurs = $errorCount"
mcl2_databasesSize=$(su -c "psql -U postgres --tuples-only -c \"SELECT ROUND((CAST(SUM(pg_database_size(datname)) AS decimal) / 1024 / 1024)::numeric, 2) FROM pg_database WHERE datname LIKE 'minetest%mineclone2'\"" postgres | xargs 2> /dev/null) mcl2_databasesSize=$(su -l -c "psql -U postgres --tuples-only -c \"SELECT ROUND((CAST(SUM(pg_database_size(datname)) AS decimal) / 1024 / 1024)::numeric, 2) FROM pg_database WHERE datname LIKE 'minetest%mineclone2'\"" postgres | xargs 2> /dev/null)
echo "Taille des bases de données mineclone2 = $mcl2_databasesSize MB" echo "Taille des bases de données mineclone2 = $mcl2_databasesSize MB"
echo -e "\n" echo -e "\n"

View File

@ -12,21 +12,12 @@ main() {
} }
post_report() { post_report() {
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json) curl -v -s \
cat <<EOF > "${datafile}"
{
"issue": {
"notes": "$(/srv/minetest.chapril.org/tools/rapport_activite/rapport_activite.sh -p| sed -z 's/\n/\\n/g')"
}
}
EOF
curl -s \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "X-Redmine-API-Key: ${REDMINE_API_KEY}" \ -H "X-Redmine-API-Key: ${REDMINE_API_KEY}" \
-X PUT --data-binary "@${datafile}" \ -X PUT --data-binary "@-" \
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json" "${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json" \
rm "${datafile}" < <(/srv/minetest.chapril.org/tools/rapport_activite/rapport_activite_mineclone2.sh -p | jq --raw-input --slurp '{ "issue": {"notes": .} }')
} }
last_comment_date() { last_comment_date() {