Daniel Gibbs 8 лет назад
Родитель
Сommit
e37b917c66
2 измененных файлов с 35 добавлено и 1 удалено
  1. 14 1
      lgsm/functions/alert.sh
  2. 21 0
      lgsm/functions/alert_pushover.sh

+ 14 - 1
lgsm/functions/alert.sh

@@ -100,8 +100,21 @@ if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then
 elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
 	fn_print_warn_nl "Discord alerts not enabled"
 	fn_script_log_warn "Discord alerts not enabled"
-elif [ -z "${discordalert}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+elif [ -z "${discordtoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
 	fn_print_error_nl "Discord token not set"
 	echo "	* https://github.com/GameServerManagers/LinuxGSM/wiki/Discord"
 	fn_script_error_warn "Discord token not set"
 fi
+
+if [ "${pushoveralert}" == "on" ]&&[ -n "${pushoveralert}" ]; then
+	alert_discord.sh
+elif [ "${pushoveralert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+	fn_print_warn_nl "Pushover alerts not enabled"
+	fn_script_log_warn "Pushover alerts not enabled"
+elif [ -z "${pushovertoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+	fn_print_error_nl "Pushover token not set"
+	echo "	* https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover"
+	fn_script_error_warn "Pushover token not set"
+fi
+
+

+ 21 - 0
lgsm/functions/alert_pushover.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+# LinuxGSM alert_pushover.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Sends Pushover alert.
+
+local commandname="ALERT"
+local commandaction="Alert"
+local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
+
+json=$(cat <<EOF
+{
+	"token": "KzGDORePKggMaC0QOYAMyEEuzJnyUi",
+	"user": "e9e1495ec75826de5983cd1abc8031",
+	"device": "all",
+	"title": "Backup finished - SQL1",
+	"message": "TEST"
+EOF
+)
+
+curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushover.net/1/messages.json"