diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index cc2de13..c95dbf3 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -49,26 +49,26 @@ __EOF } send_notification() { -[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") -UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) -printf "\nSending email notification\n" + printf "\nSending email notification.\n" -MessageTitle="Updates available on" -# Setting the MessageBody variable here. -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" + MessageTitle="Updates available on" + # Setting the MessageBody variable here. + printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" -trigger_notification + trigger_notification } ### Remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { -printf "\nSending email dockcheck notification\n" + printf "\nSending email dockcheck notification.\n" -MessageTitle="New version of dockcheck available on" -# Setting the MessageBody variable here. -printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3" + MessageTitle="New version of dockcheck available on" + # Setting the MessageBody variable here. + printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3" -trigger_notification + trigger_notification } diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index 3e20475..8c0736f 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -37,11 +37,11 @@ send_notification() { ### Remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { - printf "\nSending Apprise 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 + printf "\nSending Apprise 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 } diff --git a/notify_templates/notify_generic.sh b/notify_templates/notify_generic.sh index 5766a41..0acb1c8 100644 --- a/notify_templates/notify_generic.sh +++ b/notify_templates/notify_generic.sh @@ -6,33 +6,31 @@ FromHost=$(hostname) trigger_notification() { - - printf "\n$MessageTitle\n" - printf "\n$MessageBody\n" + # Modify to fit your setup: + printf "\n$MessageTitle\n" + printf "\n$MessageBody\n" } send_notification() { - [ -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 + [ -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 } ### Remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { - 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 + 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 } diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index 7fc10b1..ae7279a 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -35,11 +35,11 @@ send_notification() { ### Remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { - printf "\nSending Apprise dockcheck notification\n" + printf "\nSending Apprise 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" + 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 + trigger_notification } diff --git a/notify_templates/notify_matrix.sh b/notify_templates/notify_matrix.sh index 2a93a1e..50a0805 100644 --- a/notify_templates/notify_matrix.sh +++ b/notify_templates/notify_matrix.sh @@ -33,11 +33,11 @@ send_notification() { ### Remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { - printf "\nSending Matrix 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 + printf "\nSending Matrix 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 } diff --git a/notify_templates/notify_ntfy-sh.sh b/notify_templates/notify_ntfy-sh.sh index 867dcaa..f174e1a 100644 --- a/notify_templates/notify_ntfy-sh.sh +++ b/notify_templates/notify_ntfy-sh.sh @@ -4,23 +4,39 @@ # Setup app and subscription at https://ntfy.sh # Use your unique Topic Name in the URL below. -send_notification() { -[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") -UpdToString=$( printf '%s\\n' "${Updates[@]}" ) FromHost=$(hostname) -printf "\nSending ntfy.sh notification\n" - -MessageTitle="$FromHost - updates available." -# Setting the MessageBody variable here. -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" - -# Modify to fit your setup: -NtfyUrl="ntfy.sh/YourUniqueTopicName" - -curl -sS -o /dev/null --show-error --fail \ - -H "Title: $MessageTitle" \ - -d "$MessageBody" \ - $NtfyUrl +trigger_notification() { + # Modify to fit your setup: + NtfyUrl="ntfy.sh/YourUniqueTopicName" + curl -sS -o /dev/null --show-error --fail \ + -H "Title: $MessageTitle" \ + -d "$MessageBody" \ + $NtfyUrl +} + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + printf "\nSending ntfy.sh notification\n" + + MessageTitle="$FromHost - updates available." + # Setting the MessageBody variable here. + printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" + + trigger_notification +} + +### Remove or comment out the following function +### to not send notifications when dockcheck itself has updates. +dockcheck_notification() { + printf "\nSending ntfy.sh 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 } diff --git a/notify_templates/notify_pushbullet.sh b/notify_templates/notify_pushbullet.sh index a07b604..2630203 100644 --- a/notify_templates/notify_pushbullet.sh +++ b/notify_templates/notify_pushbullet.sh @@ -5,23 +5,39 @@ # Requires jq installed and in PATH. # Modify to fit your setup - set Url and Token. -send_notification() { -[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") -UpdToString=$( printf '%s\\n' "${Updates[@]}" ) FromHost=$(hostname) -# platform specific notification code would go here -printf "\nSending pushbullet notification\n" - -MessageTitle="$FromHost - updates available." -# Setting the MessageBody variable here. -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" - -# Modify to fit your setup: -PushUrl="https://api.pushbullet.com/v2/pushes" -PushToken="Your Pushbullet token here" - -# Requires jq to process json data -jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @- +trigger_notification() { + # Modify to fit your setup: + PushUrl="https://api.pushbullet.com/v2/pushes" + PushToken="Your Pushbullet token here" + # Requires jq to process json data + jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @- +} + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + # platform specific notification code would go here + printf "\nSending pushbullet notification\n" + + MessageTitle="$FromHost - updates available." + # Setting the MessageBody variable here. + printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" + + trigger_notification +} + +### Remove or comment out the following function +### to not send notifications when dockcheck itself has updates. +dockcheck_notification() { + printf "\nSending pushbullet 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 } diff --git a/notify_templates/notify_pushover.sh b/notify_templates/notify_pushover.sh index 51cf036..73dbdb3 100644 --- a/notify_templates/notify_pushover.sh +++ b/notify_templates/notify_pushover.sh @@ -5,18 +5,9 @@ # Requires jq installed and in PATH. # Modify to fit your setup - set Url and Token. -send_notification() { - [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") - UpdToString=$( printf '%s\\n' "${Updates[@]}" ) - FromHost=$(hostname) - - # platform specific notification code would go here - printf "\nSending pushover notification\n" - - MessageTitle="$FromHost - updates available." - # Setting the MessageBody variable here. - printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" +FromHost=$(hostname) +trigger_notification() { # Modify to fit your setup: PushoverUrl="https://api.pushover.net/1/messages.json" PushoverUserKey="Your Pushover User Key Here" @@ -30,3 +21,29 @@ send_notification() { -F "message=$MessageBody" \ $PushoverUrl } + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + # platform specific notification code would go here + printf "\nSending pushover notification\n" + + MessageTitle="$FromHost - updates available." + # Setting the MessageBody variable here. + printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" + + trigger_notification +} + +### Remove or comment out the following function +### to not send notifications when dockcheck itself has updates. +dockcheck_notification() { + printf "\nSending Apprise 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 +} diff --git a/notify_templates/notify_smtp.sh b/notify_templates/notify_smtp.sh index 4d98afd..ce6fa58 100644 --- a/notify_templates/notify_smtp.sh +++ b/notify_templates/notify_smtp.sh @@ -16,25 +16,19 @@ else echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1 fi -send_notification() { -[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") -UpdToString=$( printf '%s\\n' "${Updates[@]}" ) FromHost=$(hostname) +trigger_notification() { # User variables: SendMailFrom="me@mydomain.tld" SendMailTo="me@mydomain.tld" SubjectTag="dockcheck" -printf "\nSending email notification.\n" - -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" - $MailPkg $SendMailTo << __EOF From: "$FromHost" <$SendMailFrom> date:$(date -R) To: <$SendMailTo> -Subject: [$SubjectTag] Updates available on $FromHost +Subject: [$SubjectTag] $MessageTitle $FromHost Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit @@ -42,3 +36,28 @@ $MessageBody __EOF } + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + printf "\nSending email notification.\n" + + MessageTitle="Updates available on" + # Setting the MessageBody variable here. + printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" + + trigger_notification +} + +### Remove or comment out the following function +### to not send notifications when dockcheck itself has updates. +dockcheck_notification() { + printf "\nSending email dockcheck notification.\n" + + MessageTitle="New version of dockcheck available on" + # Setting the MessageBody variable here. + printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3" + + trigger_notification +} diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index 4772149..ca861a0 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -4,17 +4,9 @@ # Required receiving services must already be set up. # Modify to fit your setup - set TelegramChatId and TelegramToken. -send_notification() { - [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") - UpdToString=$( printf '%s\\n' "${Updates[@]}" ) - FromHost=$(hostname) - - # platform specific notification code would go here - printf "\nSending Telegram notification\n" - - # Setting the MessageBody variable here. - MessageBody="🐋 Containers on $FromHost with updates available: \n$UpdToString" +FromHost=$(hostname) +trigger_notification() { # Modify to fit your setup: TelegramToken="Your Telegram token here" TelegramChatId="Your Telegram ChatId here" @@ -24,4 +16,27 @@ send_notification() { curl -sS -o /dev/null --fail -X POST "$TelegramUrl/sendMessage" -H 'Content-Type: application/json' -d "$TelegramData" +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + # platform specific notification code would go here + printf "\nSending Telegram notification\n" + + # Setting the MessageBody variable here. + MessageBody="🐋 Containers on $FromHost with updates available: \n$UpdToString" + + trigger_notification +} + +### Remove or comment out the following function +### to not send notifications when dockcheck itself has updates. +dockcheck_notification() { + printf "\nSending Matrix dockcheck notification\n" + + MessageTitle="$FromHost - New version of dockcheck available." + # Setting the MessageBody variable here. + printf -v MessageBody "$FromHost - New version of dockcheck available.\n\nInstalled version: $1 \nLatest version: $2 \n\nChangenotes: $3" + + trigger_notification }