Skip to content

Commit

Permalink
#120 - Added new mechanic for sending notify on different ways of sto…
Browse files Browse the repository at this point in the history
…p/exit/hard-kills
  • Loading branch information
jammsen committed Feb 3, 2024
1 parent 2a8702b commit 0a833fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions includes/webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ send_webhook_notification() {
# Prod Curl
curl --silent --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL"
}

send_stop_notification() {
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_webhook_notification "$WEBHOOK_STOP_TITLE" "$WEBHOOK_STOP_DESCRIPTION" "$WEBHOOK_STOP_COLOR"
fi
}
5 changes: 2 additions & 3 deletions servermanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ term_handler() {
fi
kill -SIGTERM $(pidof PalServer-Linux-Test)
tail --pid=$(pidof PalServer-Linux-Test) -f 2>/dev/null
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_webhook_notification "$WEBHOOK_STOP_TITLE" "$WEBHOOK_STOP_DESCRIPTION" "$WEBHOOK_STOP_COLOR"
fi
send_stop_notification
exit 143;
}

Expand All @@ -72,5 +70,6 @@ killpid="$!"
while true
do
wait $killpid
send_stop_notification
exit 0;
done

0 comments on commit 0a833fc

Please sign in to comment.