29 lines
662 B
Bash
Executable File
29 lines
662 B
Bash
Executable File
#! /bin/bash
|
|
|
|
source "/etc/visio.chapril.org/visiochaprilorg.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/visio.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
|