29 lines
665 B
Bash
29 lines
665 B
Bash
|
#! /bin/bash
|
||
|
|
||
|
source "/etc/qrcode.chapril.org/qrcodechaprilorg.conf"
|
||
|
source "/etc/chagirbot/agiraprilorg.conf"
|
||
|
REDMINE_API_KEY="$key"
|
||
|
|
||
|
#
|
||
|
post_report()
|
||
|
{
|
||
|
datafile=$(mktemp /tmp/report_stats_$(date +%Y-%m-%d_%H%M)_XXXX.json)
|
||
|
cat <<EOF > "${datafile}"
|
||
|
{
|
||
|
"issue": {
|
||
|
"notes": "$(/srv/qrcode.chapril.org/tools/rapport_activite/rapport_activite.sh -p | sed -z 's/\n/\\n/g')"
|
||
|
}
|
||
|
}
|
||
|
EOF
|
||
|
|
||
|
curl -s \
|
||
|
-H "Content-Type: application/json" \
|
||
|
-H "X-Redmine-API-Key: ${REDMINE_API_KEY}" \
|
||
|
-X PUT --data-binary "@${datafile}" \
|
||
|
"${REDMINE_BASE_URL}/issues/${REDMINE_TICKET_ID}.json"
|
||
|
rm "${datafile}"
|
||
|
}
|
||
|
|
||
|
# Main.
|
||
|
post_report
|