Compare commits
No commits in common. "584cd84b95fb9259a535f25e353906b6188f6b93" and "a765b6e4ab8a249650683dc8f832b6240da9df1b" have entirely different histories.
584cd84b95
...
a765b6e4ab
@ -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 -l -c "psql -U postgres -d minetest-auth --tuples-only -c \"SELECT COUNT(*) FROM auth\"" postgres | xargs 2> /dev/null)
|
accountTotalCount=$(su -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 -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)
|
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)
|
||||||
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"
|
||||||
@ -91,7 +91,7 @@ elif [ "$#" = 1 ] && [ "$1" = "-p" ]; then
|
|||||||
month="$year$precedingMonth"
|
month="$year$precedingMonth"
|
||||||
fi
|
fi
|
||||||
monthEnglish=$(LANG=en_EN.UTF-8;date -d $year-$precedingMonth-01 +%b)
|
monthEnglish=$(LANG=en_EN.UTF-8;date -d $year-$precedingMonth-01 +%b)
|
||||||
echo -e "Rapport d'activité du service minetest.chapril.org - instance mineclone2 - du mois $monthEnglish $year"
|
echo -e "Rapport d'activité du service minetest.chapril.org -instance mineclone2- du mois $monthEnglish $year"
|
||||||
generateReport "$monthEnglish" "$month" "$year"
|
generateReport "$monthEnglish" "$month" "$year"
|
||||||
elif [ "$#" -eq 2 ]; then
|
elif [ "$#" -eq 2 ]; then
|
||||||
if ! (let "$1") 2>/dev/null; then
|
if ! (let "$1") 2>/dev/null; then
|
||||||
@ -117,14 +117,14 @@ elif [ "$#" -eq 2 ]; then
|
|||||||
fi
|
fi
|
||||||
monthEnglish=$(LANG=en_EN.UTF-8;date -d "$2-$1-01" +%b)
|
monthEnglish=$(LANG=en_EN.UTF-8;date -d "$2-$1-01" +%b)
|
||||||
year="$2"
|
year="$2"
|
||||||
echo -e "Rapport d'activité du service minetest.chapril.org - instance mineclone2 - du mois $monthEnglish $2"
|
echo -e "Rapport d'activité du service minetest.chapril.org -instance mineclone2- du mois $monthEnglish $2"
|
||||||
generateReport "$monthEnglish" "$month" "$year"
|
generateReport "$monthEnglish" "$month" "$year"
|
||||||
fi
|
fi
|
||||||
elif [ "$#" -eq 0 ]; then
|
elif [ "$#" -eq 0 ]; then
|
||||||
month="$(date +%Y%m)"
|
month="$(date +%Y%m)"
|
||||||
monthEnglish=$(LANG=en_EN.UTF-8;date +%b)
|
monthEnglish=$(LANG=en_EN.UTF-8;date +%b)
|
||||||
year="$(date +%Y)"
|
year="$(date +%Y)"
|
||||||
echo -e "Rapport d'activité du service minetest.chapril.org - instance mineclone2 - du mois $(date +%b) 20$(date +%y)"
|
echo -e "Rapport d'activité du service minetest.chapril.org -instance mineclone2- du mois $(date +%b) 20$(date +%y)"
|
||||||
generateReport "$monthEnglish" "$month" "$year"
|
generateReport "$monthEnglish" "$month" "$year"
|
||||||
else
|
else
|
||||||
echo -e "Bad parameter."
|
echo -e "Bad parameter."
|
||||||
|
@ -12,12 +12,21 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post_report() {
|
post_report() {
|
||||||
curl -v -s \
|
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json)
|
||||||
|
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 "@-" \
|
-X PUT --data-binary "@${datafile}" \
|
||||||
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json" \
|
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json"
|
||||||
< <(/srv/minetest.chapril.org/tools/rapport_activite/rapport_activite_mineclone2.sh -p | jq --raw-input --slurp '{ "issue": {"notes": .} }')
|
rm "${datafile}"
|
||||||
}
|
}
|
||||||
|
|
||||||
last_comment_date() {
|
last_comment_date() {
|
||||||
|
Loading…
Reference in New Issue
Block a user