alert_pushbullet.sh 880 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # LGSM alert_pushbullet.sh function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. # Description: Sends Pushbullet alert including the server status.
  6. local commandname="ALERT"
  7. local commandaction="Alert"
  8. local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. fn_print_dots "Sending Pushbullet alert"
  10. sleep 1
  11. pushbulletsend=$(curl --silent -u """${pushbullettoken}"":" -d channel_tag="${channeltag}" -d type="note" -d body="${alertbody}" -d title="${alertsubject}" 'https://api.pushbullet.com/v2/pushes'|grep -o invalid_access_token|uniq)
  12. if [ "${pushbulletsend}" == "invalid_access_token" ]; then
  13. fn_print_fail_nl "Sending Pushbullet alert: invalid_access_token"
  14. fn_script_log_fatal "Sending Pushbullet alert: invalid_access_token"
  15. else
  16. fn_print_ok_nl "Sending Pushbullet alert"
  17. fn_script_log_pass "Sent Pushbullet alert"
  18. fi