From 1548b03a9e2fcc479d38440181702fdd1f21fc99 Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 7 Feb 2025 20:47:01 +0100 Subject: [PATCH 1/9] added else with inclusion of new function, rewrote 2 templates for testing --- dockcheck.sh | 14 ++++++----- notify_templates/notify_DSM.sh | 38 +++++++++++++++++++++++------- notify_templates/notify_apprise.sh | 38 +++++++++++++++++++++++------- 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index f42febf..f69979f 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -152,7 +152,7 @@ progress_bar() { } # Function to add user-provided urls to releasenotes -releasenotes() { +releasenotes() { for update in ${GotUpdates[@]}; do found=false while read -r container url; do @@ -168,6 +168,8 @@ if [[ "$VERSION" != "$LatestRelease" ]] ; then if [[ -z "$AutoUp" ]] ; then read -r -p "Would you like to update? y/[n]: " SelfUpdate [[ "$SelfUpdate" =~ [yY] ]] && self_update + else + [[ -n "$Notify" ]] && { [[ $(type -t dockcheck_notification) == function ]] && dockcheck_notification "$VERSION" "$LatestRelease" "$LatestChanges" || printf "Could not source notification function.\n" ; } fi fi @@ -186,8 +188,8 @@ binary_downloader() { *) printf "\n%bArchitecture not supported, exiting.%b\n" "$c_red" "$c_reset" ; exit 1;; esac GetUrl="${BinaryUrl/TEMP/"$architecture"}" - if [[ $(command -v curl) ]]; then curl -L $GetUrl > "$ScriptWorkDir/$BinaryName" ; - elif [[ $(command -v wget) ]]; then wget $GetUrl -O "$ScriptWorkDir/$BinaryName" ; + if [[ $(command -v curl) ]]; then curl -L $GetUrl > "$ScriptWorkDir/$BinaryName" ; + elif [[ $(command -v wget) ]]; then wget $GetUrl -O "$ScriptWorkDir/$BinaryName" ; else printf "%s\n" "curl/wget not available - get $BinaryName manually from the repo link, exiting."; exit 1; fi [[ -f "$ScriptWorkDir/$BinaryName" ]] && chmod +x "$ScriptWorkDir/$BinaryName" @@ -211,13 +213,13 @@ else GetJq=${GetJq:-no} # set default to no if nothing is given if [[ "$GetJq" =~ [yYsS] ]] ; then [[ "$GetJq" =~ [yY] ]] && distro_checker - if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then + if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then (sudo $PkgInstaller jq) ; PkgExitcode="$?" [[ "$PkgExitcode" == 0 ]] && jqbin="jq" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi if [[ "$GetJq" =~ [nN] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP" - [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" + [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" fi else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi @@ -232,7 +234,7 @@ else read -r -p "Required dependency 'regctl' missing, do you want it downloaded? y/[n] " GetRegctl if [[ "$GetRegctl" =~ [yY] ]] ; then binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" - [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" + [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi fi diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index 6aabf1f..eec76b8 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -17,10 +17,9 @@ 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() { CfgFile="/usr/syno/etc/synosmtp.conf" # User variables: @@ -34,15 +33,11 @@ SenderName=$(grep 'smtp_from_name' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p') SenderMail=$(grep 'smtp_from_mail' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p') SenderMail=${SenderMail:-$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')} -printf "\nSending email notification.\n" - -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" - $MailPkg $SendMailTo << __EOF From: "$SenderName" <$SenderMail> 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 @@ -52,3 +47,30 @@ __EOF # This ensures DSM's container manager will also see the update /var/packages/ContainerManager/target/tool/image_upgradable_checker } + +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_apprise.sh b/notify_templates/notify_apprise.sh index 8663d43..377dd73 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -4,18 +4,11 @@ # Required receiving services must already be set up. # Modify to fit your setup - if API, set AppriseURL to your Apprise ip/domain. -send_notification() { -[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") -UpdToString=$( printf '%s\\n' "${Updates[@]}" ) FromHost=$(hostname) -printf "\nSending Apprise notification\n" +trigger_notification() { -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: +### Modify to fit your setup: apprise -vv -t "$MessageTitle" -b "$MessageBody" \ mailto://myemail:mypass@gmail.com \ mastodons://{token}@{host} \ @@ -28,3 +21,30 @@ apprise -vv -t "$MessageTitle" -b "$MessageBody" \ # curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL } + +send_notification() { +[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") +UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + +printf "\nSending Apprise 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 + +} From 71967277aaa291e48561379b9f0aa1b0421c38a3 Mon Sep 17 00:00:00 2001 From: mag37 Date: Sun, 9 Feb 2025 22:01:08 +0100 Subject: [PATCH 2/9] new notification structure --- notify_templates/notify_DSM.sh | 2 -- notify_templates/notify_apprise.sh | 47 ++++++++++++++---------------- notify_templates/notify_discord.sh | 35 +++++++++++++--------- notify_templates/notify_generic.sh | 28 ++++++++++++++++-- notify_templates/notify_gotify.sh | 40 +++++++++++++++++-------- notify_templates/notify_matrix.sh | 39 +++++++++++++++++-------- 6 files changed, 123 insertions(+), 68 deletions(-) diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index eec76b8..cc2de13 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -59,7 +59,6 @@ MessageTitle="Updates available on" printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString" trigger_notification - } ### Remove or comment out the following function @@ -72,5 +71,4 @@ MessageTitle="New version of dockcheck available on" printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3" trigger_notification - } diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index 377dd73..3e20475 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -8,43 +8,40 @@ FromHost=$(hostname) trigger_notification() { -### Modify to fit your setup: -apprise -vv -t "$MessageTitle" -b "$MessageBody" \ - mailto://myemail:mypass@gmail.com \ - mastodons://{token}@{host} \ - pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \ - tgram://{bot_token}/{chat_id}/ - -### If you use the Apprise-API - Comment out the apprise command above. -### Uncomment the AppriseURL and the curl-line below: -# AppriseURL="http://apprise.mydomain.tld:1234/notify/apprise" -# curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL + ### Modify to fit your setup: + apprise -vv -t "$MessageTitle" -b "$MessageBody" \ + mailto://myemail:mypass@gmail.com \ + mastodons://{token}@{host} \ + pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \ + tgram://{bot_token}/{chat_id}/ + ### If you use the Apprise-API - Comment out the apprise command above. + ### Uncomment the AppriseURL and the curl-line below: + # AppriseURL="http://apprise.mydomain.tld:1234/notify/apprise" + # curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL } 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 Apprise notification\n" + printf "\nSending Apprise notification\n" -MessageTitle="$FromHost - updates available." -# Setting the MessageBody variable here. -printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString" - -trigger_notification + 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" + 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 + 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_discord.sh b/notify_templates/notify_discord.sh index b29966a..e63c237 100644 --- a/notify_templates/notify_discord.sh +++ b/notify_templates/notify_discord.sh @@ -4,25 +4,32 @@ # Required receiving services must already be set up. # Modify to fit your setup - set DiscordWebhookUrl -send_notification() { - [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") - UpdToString=$( printf '%s\\n' "${Updates[@]}" ) - - echo "$UpdToString" - FromHost=$(hostname) - - # platform specific notification code would go here - printf "\nSending Discord 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: DiscordWebhookUrl="PasteYourFullDiscordWebhookURL" MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}" - curl -sS -o /dev/null --fail -X POST -H "Content-Type: application/json" -d "$MsgBody" "$DiscordWebhookUrl" - } +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + printf "\nSending Discord 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 Discord dockcheck notification\n" + MessageBody="$FromHost - New version of dockcheck available: \n 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 e74d806..5766a41 100644 --- a/notify_templates/notify_generic.sh +++ b/notify_templates/notify_generic.sh @@ -3,14 +3,36 @@ # Copy/rename this file to notify.sh to enable the notification snippet. # generic sample, the "Hello World" of notification addons +FromHost=$(hostname) + +trigger_notification() { + + printf "\n$MessageTitle\n" + printf "\n$MessageBody\n" +} + send_notification() { [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") UpdToString=$( printf '%s\\n' "${Updates[@]}" ) - FromHost=$(hostname) # platform specific notification code would go here printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset" - printf "\nThe following docker containers on %s need to be updated:\n" "$FromHost" - printf "$UpdToString" + + 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 } diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index 49d07ae..7fc10b1 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -4,18 +4,9 @@ # Required receiving services must already be set up. # Modify to fit your setup - set GotifyUrl and GotifyToken. -send_notification() { - [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || 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." - printf -v MessageBody "Containers on $FromHost with updates available:\n$UpdToString" +FromHost=$(hostname) +trigger_notification() { # Modify to fit your setup: GotifyToken="Your Gotify token here" GotifyUrl="https://api.gotify/message?token=${GotifyToken}" @@ -25,5 +16,30 @@ send_notification() { -F "message=${MessageBody}" \ -F "priority=5" \ -X POST "${GotifyUrl}" 1> /dev/null - +} + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + # platform specific notification code would go here + printf "\nSending Gotify notification\n" + + # Setting the MessageTitle and MessageBody variable here. + 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 "\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_matrix.sh b/notify_templates/notify_matrix.sh index acbcb34..2a93a1e 100644 --- a/notify_templates/notify_matrix.sh +++ b/notify_templates/notify_matrix.sh @@ -4,17 +4,9 @@ # Required receiving services must already be set up. # Modify to fit your setup - set MatrixServer, Room_id and AccessToken -send_notification() { - [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") - UpdToString=$( printf '%s\\n' "${Updates[@]}" ) - FromHost=$(hostname) - - # platform specific notification code would go here - printf "\nSending Matrix 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: AccessToken="Your Matrix token here" Room_id="Enter Room_id here" @@ -22,7 +14,30 @@ send_notification() { MsgBody="{\"msgtype\":\"m.text\",\"body\":\"$MessageBody\"}" # URL Example: https://matrix.org/_matrix/client/r0/rooms/!xxxxxx:example.com/send/m.room.message?access_token=xxxxxxxx - curl -sS -o /dev/null --fail -X POST "$MatrixServer/_matrix/client/r0/rooms/$Room_id/send/m.room.message?access_token=$AccessToken" -H 'Content-Type: application/json' -d "$MsgBody" - +} + +send_notification() { + [ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@") + UpdToString=$( printf '%s\\n' "${Updates[@]}" ) + + # platform specific notification code would go here + printf "\nSending Matrix 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 "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3" + + trigger_notification } From 111cb955b1e20e48dba822568678daa2b10f52c7 Mon Sep 17 00:00:00 2001 From: mag37 Date: Mon, 10 Feb 2025 19:46:23 +0100 Subject: [PATCH 3/9] finalizing new notification structure --- notify_templates/notify_DSM.sh | 24 +++++++------- notify_templates/notify_apprise.sh | 14 ++++---- notify_templates/notify_generic.sh | 40 +++++++++++----------- notify_templates/notify_gotify.sh | 10 +++--- notify_templates/notify_matrix.sh | 14 ++++---- notify_templates/notify_ntfy-sh.sh | 48 ++++++++++++++++++--------- notify_templates/notify_pushbullet.sh | 48 ++++++++++++++++++--------- notify_templates/notify_pushover.sh | 39 ++++++++++++++++------ notify_templates/notify_smtp.sh | 35 ++++++++++++++----- notify_templates/notify_telegram.sh | 35 +++++++++++++------ 10 files changed, 194 insertions(+), 113 deletions(-) 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 } From 96ebe079a4889ff8753052f890a9431c4a6dd152 Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 21:28:21 +0100 Subject: [PATCH 4/9] removed 'not source' message as its optional --- dockcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockcheck.sh b/dockcheck.sh index f69979f..dfc7d0e 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -169,7 +169,7 @@ if [[ "$VERSION" != "$LatestRelease" ]] ; then read -r -p "Would you like to update? y/[n]: " SelfUpdate [[ "$SelfUpdate" =~ [yY] ]] && self_update else - [[ -n "$Notify" ]] && { [[ $(type -t dockcheck_notification) == function ]] && dockcheck_notification "$VERSION" "$LatestRelease" "$LatestChanges" || printf "Could not source notification function.\n" ; } + [[ -n "$Notify" ]] && { [[ $(type -t dockcheck_notification) == function ]] && dockcheck_notification "$VERSION" "$LatestRelease" "$LatestChanges" ; } fi fi From c436def448dbfa4bf25cba1db030e1ec0f1eca51 Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 21:34:03 +0100 Subject: [PATCH 5/9] typo --- notify_templates/notify_telegram.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index ca861a0..d47e29a 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -15,6 +15,7 @@ trigger_notification() { TelegramData="{\"chat_id\":\"$TelegramChatId\",\"text\":\"$MessageBody\",\"message_thread_id\":\"$TelegramTopicID\",\"disable_notification\": false}" 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=("$@") From 06ea7fff6d340b53d20d6b6b89805b5de54b8eaa Mon Sep 17 00:00:00 2001 From: mag37 Date: Sat, 15 Feb 2025 13:35:47 +0100 Subject: [PATCH 6/9] newline and rephrasing --- notify_templates/notify_DSM.sh | 4 ++-- notify_templates/notify_apprise.sh | 2 +- notify_templates/notify_discord.sh | 2 +- notify_templates/notify_generic.sh | 2 +- notify_templates/notify_gotify.sh | 2 +- notify_templates/notify_matrix.sh | 2 +- notify_templates/notify_ntfy-sh.sh | 2 +- notify_templates/notify_pushbullet.sh | 2 +- notify_templates/notify_pushover.sh | 2 +- notify_templates/notify_smtp.sh | 2 +- notify_templates/notify_telegram.sh | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index c95dbf3..7d38236 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -61,14 +61,14 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" + printf -v MessageBody "Installed version: $1\nLatest version: $2\n\nChangenotes: $3\n" trigger_notification } diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index 8c0736f..a687eb9 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -34,7 +34,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_discord.sh b/notify_templates/notify_discord.sh index e63c237..2f7f913 100644 --- a/notify_templates/notify_discord.sh +++ b/notify_templates/notify_discord.sh @@ -25,7 +25,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_notification), remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { printf "\nSending Discord dockcheck notification\n" diff --git a/notify_templates/notify_generic.sh b/notify_templates/notify_generic.sh index 0acb1c8..b93c2b2 100644 --- a/notify_templates/notify_generic.sh +++ b/notify_templates/notify_generic.sh @@ -23,7 +23,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_notification), remove or comment out the following function ### to not send notifications when dockcheck itself has updates. dockcheck_notification() { printf "\nGeneric dockcheck notification\n" diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index ae7279a..780cb94 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -32,7 +32,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_matrix.sh b/notify_templates/notify_matrix.sh index 50a0805..9279a42 100644 --- a/notify_templates/notify_matrix.sh +++ b/notify_templates/notify_matrix.sh @@ -30,7 +30,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_ntfy-sh.sh b/notify_templates/notify_ntfy-sh.sh index f174e1a..68b293b 100644 --- a/notify_templates/notify_ntfy-sh.sh +++ b/notify_templates/notify_ntfy-sh.sh @@ -29,7 +29,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_pushbullet.sh b/notify_templates/notify_pushbullet.sh index 2630203..7429e03 100644 --- a/notify_templates/notify_pushbullet.sh +++ b/notify_templates/notify_pushbullet.sh @@ -30,7 +30,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_pushover.sh b/notify_templates/notify_pushover.sh index 73dbdb3..38955e2 100644 --- a/notify_templates/notify_pushover.sh +++ b/notify_templates/notify_pushover.sh @@ -36,7 +36,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_smtp.sh b/notify_templates/notify_smtp.sh index ce6fa58..551e434 100644 --- a/notify_templates/notify_smtp.sh +++ b/notify_templates/notify_smtp.sh @@ -50,7 +50,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index d47e29a..4a10a50 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -30,7 +30,7 @@ send_notification() { trigger_notification } -### Remove or comment out the following function +### Rename (eg. disabled_dockcheck_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" From 9b0b6137a3cb207e76fb2f7b49e51708ac89db44 Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 7 Mar 2025 21:05:58 +0100 Subject: [PATCH 7/9] fixed typos --- notify_templates/notify_gotify.sh | 2 +- notify_templates/notify_pushover.sh | 2 +- notify_templates/notify_telegram.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index 780cb94..d5eae60 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -35,7 +35,7 @@ send_notification() { ### Rename (eg. disabled_dockcheck_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 Gotify dockcheck notification\n" MessageTitle="$FromHost - New version of dockcheck available." # Setting the MessageBody variable here. diff --git a/notify_templates/notify_pushover.sh b/notify_templates/notify_pushover.sh index 38955e2..69e951f 100644 --- a/notify_templates/notify_pushover.sh +++ b/notify_templates/notify_pushover.sh @@ -39,7 +39,7 @@ send_notification() { ### Rename (eg. disabled_dockcheck_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 pushover dockcheck notification\n" MessageTitle="$FromHost - New version of dockcheck available." # Setting the MessageBody variable here. diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index 4a10a50..e8bd8df 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -33,7 +33,7 @@ send_notification() { ### Rename (eg. disabled_dockcheck_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" + printf "\nSending Telegram dockcheck notification\n" MessageTitle="$FromHost - New version of dockcheck available." # Setting the MessageBody variable here. From 8fc4f41c491ee09423ff07891ffd75afa5758efc Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 7 Mar 2025 21:11:01 +0100 Subject: [PATCH 8/9] version bump and change notes --- README.md | 2 ++ dockcheck.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e9ab79..37a8d7f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Made MaxAsync=1 the default - edit to change. Added -x option to pass a MaxAsync value on runtime. Made it possible to disable xargs -P-flag by setting MaxAsync=0 or passing -x 0 option. +- **v0.5.7.0**: Rewritten templates - now with a function to notify when there's a new Dockcheck release. + - Manually migrate your current `notify.sh` settings to a new template. - **v0.5.6.1**: Async xargs hotfix - due to errors `failed to request manifest head ... context canceled` - Defaulted subprocess to 1 with `MaxAsync=1`, increase to find a stable value in your environment. - Added `-x N` option to pass `MaxAsync` value at runtime. diff --git a/dockcheck.sh b/dockcheck.sh index 4bf7309..b717dd0 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="v0.5.6.1" -### ChangeNotes: Async hotfix, 1 subprocess default, modify MaxAsync variable or pass -x N option to increase. +VERSION="v0.5.7.0" +### ChangeNotes: Rewritten templates - now with a function to notify when theres a new Dockcheck release. Github="https://github.com/mag37/dockcheck" RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh" From dcbdb5becdfd18c06ee3f8f785c902b02c75dfa7 Mon Sep 17 00:00:00 2001 From: mag37 Date: Sun, 9 Mar 2025 09:57:45 +0100 Subject: [PATCH 9/9] minor fixes --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 37a8d7f..5e3f418 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Added -x option to pass a MaxAsync value on runtime. Made it possible to disable xargs -P-flag by setting MaxAsync=0 or passing -x 0 option. - **v0.5.7.0**: Rewritten templates - now with a function to notify when there's a new Dockcheck release. - - Manually migrate your current `notify.sh` settings to a new template. + - Manually migrate your current `notify.sh` settings to a new template for new functionality. - **v0.5.6.1**: Async xargs hotfix - due to errors `failed to request manifest head ... context canceled` - Defaulted subprocess to 1 with `MaxAsync=1`, increase to find a stable value in your environment. - Added `-x N` option to pass `MaxAsync` value at runtime. @@ -97,7 +97,7 @@ ___ - regctl requires `amd64/arm64` - see [workaround](#roller_coaster-workaround-for-non-amd64--arm64) if other architecture is used. ## :tent: Install Instructions -Download the script to a directory in **PATH**, I'd suggest using `~/.local/bin` as that's usually in **PATH**. +Download the script to a directory in **PATH**, I'd suggest using `~/.local/bin` as that's usually in **PATH**. For OSX/macOS preferably use `/usr/local/bin`. ```sh # basic example with curl: @@ -192,7 +192,7 @@ Test it with `./regctl --help` and then either add the file to the same path as ## :whale: Docker Hub pull limit :chart_with_downwards_trend: not an issue for checks but for actual pulls Due to recent changes in [Docker Hub usage and limits](https://docs.docker.com/docker-hub/usage/) ->Unauthenticated users: 10 pulls/hour +>Unauthenticated users: 10 pulls/hour >Authenticated users with a free account: 100 pulls/hour This is not an issue for registry checks. But if you have a large stack and pull more than 10 updates at once consider updating more often or to create a free account.