Просмотр исходного кода

Merge branch 'feature/rocketchat' into feature/sendgrid

Daniel Gibbs 5 лет назад
Родитель
Сommit
9112068ce5

+ 1 - 1
lgsm/functions/alert_discord.sh

@@ -53,7 +53,7 @@ fn_print_dots "Sending Discord alert"
 
 discordsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${discordwebhook}")
 
-if [ "${discordsend}" ]; then
+if [ -n "${discordsend}" ]; then
 	fn_print_fail_nl "Sending Discord alert: ${discordsend}"
 	fn_script_log_fatal "Sending Discord alert: ${discordsend}"
 else

+ 1 - 1
lgsm/functions/alert_ifttt.sh

@@ -18,7 +18,7 @@ EOF
 fn_print_dots "Sending IFTTT alert"
 iftttsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")
 
-if [ "${iftttsend}" ]; then
+if [ -n "${iftttsend}" ]; then
 	fn_print_fail_nl "Sending IFTTT alert: ${pushbulletsend}"
 	fn_script_log_fatal "Sending IFTTT alert: ${pushbulletsend}"
 else

+ 1 - 1
lgsm/functions/alert_pushbullet.sh

@@ -19,7 +19,7 @@ EOF
 fn_print_dots "Sending Pushbullet alert"
 pushbulletsend=$(curl -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
 
-if [ "${pushbulletsend}" ]; then
+if [ -n "${pushbulletsend}" ]; then
 	fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"
 	fn_script_log_fatal "Sending Pushbullet alert: ${pushbulletsend}"
 else

+ 1 - 1
lgsm/functions/alert_pushover.sh

@@ -23,7 +23,7 @@ fi
 
 pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}"  -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message="<b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
 
-if [ "${pushoversend}" ]; then
+if [ -n "${pushoversend}" ]; then
 	fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
 	fn_script_log_fatal "Sending Pushover alert: ${pushoversend}"
 else

+ 4 - 4
lgsm/functions/alert_rocketchat.sh

@@ -42,12 +42,12 @@ EOF
 
 fn_print_dots "Sending Rocketchat alert"
 
-rocketlaunch=$(curl -sSL -H "Content-Type:application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${rocketchatwebhook}")
+rocketchatsend=$(curl -sSL -H "Content-Type:application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${rocketchatwebhook}")
 
-if [ "${rocketlaunch}" == "ok" ]; then
+if [ -n "${rocketchatsend}" ]; then
 	fn_print_ok_nl "Sending Rocketchat alert"
 	fn_script_log_pass "Sending Rocketchat alert"
 else
-		fn_print_fail_nl "Sending Rocketchat alert: ${rocketlaunch}"
-	fn_script_log_fatal "Sending Rocketchat alert: ${rocketlaunch}"
+		fn_print_fail_nl "Sending Rocketchat alert: ${rocketchatsend}"
+	fn_script_log_fatal "Sending Rocketchat alert: ${rocketchatsend}"
 fi

+ 1 - 1
lgsm/functions/alert_telegram.sh

@@ -18,7 +18,7 @@ EOF
 fn_print_dots "Sending Telegram alert"
 telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" ${curlcustomstring} "https://api.telegram.org/bot${telegramtoken}/sendMessage" | grep "error_code")
 
-if [ "${telegramsend}" ]; then
+if [ -n "${telegramsend}" ]; then
 	fn_print_fail_nl "Sending Telegram alert: ${telegramsend}"
 	fn_script_log_fatal "Sending Telegram alert: ${telegramsend}"
 else