dockcheck/notify_templates/notify_generic.sh

37 lines
1.3 KiB
Bash
Raw Normal View History

### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
2024-01-05 20:55:08 +01:00
#
# Copy/rename this file to notify.sh to enable the notification snippet.
2024-01-01 13:46:09 -05:00
# generic sample, the "Hello World" of notification addons
2025-02-09 22:01:08 +01:00
FromHost=$(hostname)
trigger_notification() {
2025-02-10 19:46:23 +01:00
# Modify to fit your setup:
printf "\n$MessageTitle\n"
printf "\n$MessageBody\n"
2025-02-09 22:01:08 +01:00
}
2024-01-01 13:46:09 -05:00
send_notification() {
2025-02-10 19:46:23 +01:00
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
# platform specific notification code would go here
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
MessageTitle="$FromHost - updates available."
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
trigger_notification
2025-02-09 22:01:08 +01:00
}
2025-02-15 13:35:47 +01:00
### Rename (eg. disabled_dockcheck_notification), remove or comment out the following function
2025-02-09 22:01:08 +01:00
### to not send notifications when dockcheck itself has updates.
dockcheck_notification() {
2025-02-10 19:46:23 +01:00
printf "\nGeneric dockcheck notification\n"
MessageTitle="$FromHost - New version of dockcheck available."
# Setting the MessageBody variable here.
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
trigger_notification
}