added api call

This commit is contained in:
Nicolas Roman 2019-03-15 15:31:50 +01:00
parent 269336fcf0
commit 73fbbf4d0a
1 changed files with 10 additions and 1 deletions

View File

@ -199,7 +199,16 @@ fi
SQL_TEXTE=`echo "${TEXTE}" | sed "s/'/''/g"`
PG_QUERY="INSERT INTO evomaint(hostname,userid,ipaddress,begin_date,end_date,details) VALUES ('${HOSTNAME}','${USER}','${IP}','${BEGIN_DATE}',now(),'${SQL_TEXTE}')"
echo "${PG_QUERY}" | psql ${PGDB} ${PGTABLE} -h ${PGHOST}
#echo "${PG_QUERY}" | psql ${PGDB} ${PGTABLE} -h ${PGHOST}
curl -H "Content-Type: application/json" -X POST http://172.28.128.3:8000 -d '{
"hostname": '${HOSTNAME}',
"userid": '${USER}',
"ipaddress": '${IP}',
"begin_date": '${BEGIN_DATE}',
"end_date": '$(now())',
"details": '${SQL_TEXTE}'
}'
# send mail
MAIL_TEXTE=$(echo "${TEXTE}" | sed -e "s@/@\\\\\/@g ; s@&@\\\\&@")