From da389a04e74f6449fe4ab38fe8d245195706fc7e Mon Sep 17 00:00:00 2001 From: cerealconyogurt <49502224+cerealconyogurt@users.noreply.github.com> Date: Thu, 20 Jun 2024 22:05:10 -0400 Subject: [PATCH] Create notify_gotify.sh adding Gotify template --- notify_gotify.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 notify_gotify.sh diff --git a/notify_gotify.sh b/notify_gotify.sh new file mode 100644 index 0000000..7a41a77 --- /dev/null +++ b/notify_gotify.sh @@ -0,0 +1,29 @@ +### DISCLAIMER: This is a third party addition to dockcheck - best effort testing. +# +# Copy/rename this file to notify.sh to enable the notification snippet. +# Required receiving services must already be set up. +# Modify to fit your setup - set GotifyUrl and GotifyToken. + +send_notification() { + Updates=("$@") + UpdToString=$( printf "%s\n" "${Updates[@]}" ) + FromHost=$(hostname) + + # platform specific notification code would go here + printf "\nSending Gotify notification\n" + + # Setting the MessageTitle and MessageBody variable here. + MessageTitle="${FromHost} - updates available." + MessageBody="Containers on ${FromHost} with updates available: ${UpdToString}" + + # Modify to fit your setup: + GotifyToken="Your Gotify token here" + GotifyUrl="https://api.gotify/message?token=${GotifyToken}" + + curl \ + -F "title=${MessageTitle}" \ + -F "message=${MessageBody}" \ + -F "priority=5" \ + -X POST "${GotifyUrl}" &> /dev/null + +}