#!/bin/bash # LinuxGSM alert_ifttt.sh module # Author: Daniel Gibbs # Contributors: http://linuxgsm.com/contrib # Website: https://linuxgsm.com # Description: Sends IFTTT alert. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" jsoninfo=$( cat << EOF { "value1": "${selfname}", "value2": "${alerttitle}", "value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}\n\nMore info \n${alerturl}" } EOF ) jsonnoinfo=$( cat << EOF { "value1": "${selfname}", "value2": "${alerttitle}", "value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}" } EOF ) if [ -z "${alerturl}" ]; then json="${jsonnoinfo}" else json="${jsoninfo}" fi fn_print_dots "Sending IFTTT alert" iftttsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request") if [ -n "${iftttsend}" ]; then fn_print_fail_nl "Sending IFTTT alert: ${pushbulletsend}" fn_script_log_fail "Sending IFTTT alert: ${pushbulletsend}" else fn_print_ok_nl "Sending IFTTT alert" fn_script_log_pass "Sent IFTTT alert" fi