mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
Merge pull request #135 from mag37/dockcheck_upd_notify
rewrite of notify-templates
This commit is contained in:
commit
98e80854be
13 changed files with 324 additions and 140 deletions
|
|
@ -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 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.
|
||||
|
|
@ -95,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:
|
||||
|
|
@ -190,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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
@ -174,6 +174,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
|
||||
|
||||
|
|
@ -455,3 +457,4 @@ else
|
|||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
|
|||
|
|
@ -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,28 @@ __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
|
||||
}
|
||||
|
||||
### 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\n"
|
||||
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,44 @@
|
|||
# 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:
|
||||
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[@]}" )
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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"
|
||||
MessageBody="$FromHost - New version of dockcheck available: \n Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,34 @@
|
|||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# generic sample, the "Hello World" of notification addons
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
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"
|
||||
trigger_notification() {
|
||||
# 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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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 Gotify 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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 pushover 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
### 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"
|
||||
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -23,5 +15,29 @@ send_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=("$@")
|
||||
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
|
||||
}
|
||||
|
||||
### 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 Telegram 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue