dockcheck/notify_ntfy-sh.sh

32 lines
771 B
Bash
Raw Permalink Normal View History

2024-01-15 19:47:04 +00:00
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
#
# Copy/rename this file to notify.sh to enable the notification snippet.
# Setup app and subscription at https://ntfy.sh
# Use your unique Topic Name in the URL below.
send_notification() {
Updates=("$@")
UpdToString=$( printf "%s\n" "${Updates[@]}" )
FromHost=$(hostname)
2024-01-15 19:47:51 +00:00
printf "\nSending ntfy.sh notification\n"
2024-01-15 19:47:04 +00:00
MessageTitle="$FromHost - updates available."
# Setting the MessageBody variable here.
read -d '\n' MessageBody << __EOF
Containers on $FromHost with updates available:
$UpdToString
__EOF
# Modify to fit your setup:
NtfyUrl="ntfy.sh/YourUniqueTopicName"
2024-01-15 19:47:51 +00:00
curl -sS -o /dev/null --show-error --fail \
2024-01-15 19:47:04 +00:00
-H "Title: $MessageTitle" \
-d "$MessageBody" \
$NtfyUrl
}