From 73fbbf4d0acd86b6e3a7d46722a40a3868043e17 Mon Sep 17 00:00:00 2001 From: Nicolas Roman Date: Fri, 15 Mar 2019 15:31:50 +0100 Subject: [PATCH] added api call --- evomaintenance.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/evomaintenance.sh b/evomaintenance.sh index cc50f21..4db0a98 100755 --- a/evomaintenance.sh +++ b/evomaintenance.sh @@ -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@&@\\\\&@")