krot

event_notification.sh

Aug 28th, 2020
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.45 KB | None | 0 0
  1. #!/bin/bash
  2. mysql -u user1 -pPASs --database=test --reconnect --batch -N -e "call event_notification()"  | while read host to from body;
  3. do
  4.     JSON_STRING=$( jq -n \
  5.                   --arg from1 "$from@$host" \
  6.                   --arg bo1 "$body" \
  7.                   '{to: $from1, body: $bo1}' );
  8.     curl --insecure -H "Authorization:Basic bm9000="  -H "Content-Type: application/json" -X POST https://0.0.:8089/api/messages --data "$JSON_STRING"
  9. done;
Add Comment
Please, Sign In to add comment