mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48057dfc66 | ||
|
|
98e80854be | ||
|
|
dcbdb5becd | ||
|
|
8fc4f41c49 | ||
|
|
9b0b6137a3 | ||
|
|
7ed4286fe7 | ||
|
|
bf1e78d2ff | ||
|
|
9fa398e553 | ||
|
|
9ef2ea7135 | ||
|
|
8c3b899332 | ||
|
|
8110cd8892 | ||
|
|
502a167919 | ||
|
|
06ea7fff6d | ||
|
|
c436def448 | ||
|
|
96ebe079a4 | ||
|
|
111cb955b1 | ||
|
|
71967277aa | ||
|
|
1548b03a9e |
18
README.md
18
README.md
@@ -21,7 +21,13 @@
|
|||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
|
||||||
- **v0.5.6.0**: Heavily improved performance due to async checking for updates.
|
- **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.
|
||||||
|
- To disable xargs `-P` flag (max processes) all together, set `MaxAsync` to 0.
|
||||||
|
- **v0.5.6.0**: Heavily improved performance due to async checking for updates.
|
||||||
- **v0.5.5.0**: osx and bsd compatibility changes + rewrite of dependency installer
|
- **v0.5.5.0**: osx and bsd compatibility changes + rewrite of dependency installer
|
||||||
- **v0.5.4.0**: Added support for a Prometheus+node_exporter metric collection through a file collector.
|
- **v0.5.4.0**: Added support for a Prometheus+node_exporter metric collection through a file collector.
|
||||||
- **v0.5.3.0**: Local image check changed (use imageId instead of name) and Gotify-template fixed (whale icon removed).
|
- **v0.5.3.0**: Local image check changed (use imageId instead of name) and Gotify-template fixed (whale icon removed).
|
||||||
@@ -87,7 +93,7 @@ ___
|
|||||||
- regctl requires `amd64/arm64` - see [workaround](#roller_coaster-workaround-for-non-amd64--arm64) if other architecture is used.
|
- regctl requires `amd64/arm64` - see [workaround](#roller_coaster-workaround-for-non-amd64--arm64) if other architecture is used.
|
||||||
|
|
||||||
## :tent: Install Instructions
|
## :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`.
|
For OSX/macOS preferably use `/usr/local/bin`.
|
||||||
```sh
|
```sh
|
||||||
# basic example with curl:
|
# basic example with curl:
|
||||||
@@ -107,6 +113,7 @@ Add preferred `notify.sh`-template to the same directory - this will not be touc
|
|||||||
## :loudspeaker: Notifications
|
## :loudspeaker: Notifications
|
||||||
Trigger with the `-i` flag.
|
Trigger with the `-i` flag.
|
||||||
Run it scheduled with `-ni` to only get notified when there's updates available!
|
Run it scheduled with `-ni` to only get notified when there's updates available!
|
||||||
|
Will also send a notification when `dockcheck.sh` itself has an update.
|
||||||
|
|
||||||
Use a `notify_X.sh` template file from the **notify_templates** directory, copy it to `notify.sh` alongside the script, modify it to your needs! (notify.sh is added to .gitignore)
|
Use a `notify_X.sh` template file from the **notify_templates** directory, copy it to `notify.sh` alongside the script, modify it to your needs! (notify.sh is added to .gitignore)
|
||||||
**Current templates:**
|
**Current templates:**
|
||||||
@@ -139,6 +146,11 @@ nginx -> https://github.com/docker-library/official-images/blob/master/library
|
|||||||
```
|
```
|
||||||
The `urls.list` file is just an example and I'd gladly see that people contribute back when they add their preferred URLs to their lists.
|
The `urls.list` file is just an example and I'd gladly see that people contribute back when they add their preferred URLs to their lists.
|
||||||
|
|
||||||
|
## :fast_forward: Asyncronous update checks with **xargs**; `-x N` option. (default=1)
|
||||||
|
Pass `-x N` where N is number of subprocesses allowed, experiment in your environment to find a suitable max!
|
||||||
|
Change the default value by editing the `MaxAsync=N` variable in `dockcheck.sh`. To disable the subprocess function set `MaxAsync=0`.
|
||||||
|
|
||||||
|
|
||||||
## :chart_with_upwards_trend: Prometheus and node_exporter
|
## :chart_with_upwards_trend: Prometheus and node_exporter
|
||||||
Dockcheck can be used together with [Prometheus](https://github.com/prometheus/prometheus) and [node_exporter](https://github.com/prometheus/node_exporter) to export metrics via the file collector, scheduled with cron or likely.
|
Dockcheck can be used together with [Prometheus](https://github.com/prometheus/prometheus) and [node_exporter](https://github.com/prometheus/node_exporter) to export metrics via the file collector, scheduled with cron or likely.
|
||||||
This is done with the `-c` option, like this:
|
This is done with the `-c` option, like this:
|
||||||
@@ -182,7 +194,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
|
## :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/)
|
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
|
>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.
|
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.
|
||||||
|
|||||||
21
dockcheck.sh
21
dockcheck.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.5.6.0"
|
VERSION="v0.5.7.0"
|
||||||
### ChangeNotes: Heavily improved performance due to asynchronous update checks.
|
### ChangeNotes: Rewritten templates - now with a function to notify when theres a new Dockcheck release.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@@ -13,6 +13,10 @@ ScriptWorkDir="$(dirname "$ScriptPath")"
|
|||||||
LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
|
LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
|
||||||
LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/# ChangeNotes: //p")"
|
LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/# ChangeNotes: //p")"
|
||||||
|
|
||||||
|
# User customizable defaults
|
||||||
|
MaxAsync=1
|
||||||
|
Timeout=10
|
||||||
|
|
||||||
# Help Function
|
# Help Function
|
||||||
Help() {
|
Help() {
|
||||||
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
||||||
@@ -34,6 +38,7 @@ Help() {
|
|||||||
echo "-s Include stopped containers in the check. (Logic: docker ps -a)."
|
echo "-s Include stopped containers in the check. (Logic: docker ps -a)."
|
||||||
echo "-t Set a timeout (in seconds) per container for registry checkups, 10 is default."
|
echo "-t Set a timeout (in seconds) per container for registry checkups, 10 is default."
|
||||||
echo "-v Prints current version."
|
echo "-v Prints current version."
|
||||||
|
echo "-x N Set max asynchronous subprocesses, 1 default, 0 to disable, 32+ tested."
|
||||||
echo
|
echo
|
||||||
echo "Project source: $Github"
|
echo "Project source: $Github"
|
||||||
}
|
}
|
||||||
@@ -46,10 +51,8 @@ c_blue="\033[0;34m"
|
|||||||
c_teal="\033[0;36m"
|
c_teal="\033[0;36m"
|
||||||
c_reset="\033[0m"
|
c_reset="\033[0m"
|
||||||
|
|
||||||
MaxAsync=32
|
|
||||||
Timeout=10
|
|
||||||
Stopped=""
|
Stopped=""
|
||||||
while getopts "aynpfrhlisvmc:e:d:t:" options; do
|
while getopts "aynpfrhlisvmc:e:d:t:x:" options; do
|
||||||
case "${options}" in
|
case "${options}" in
|
||||||
a|y) AutoUp="yes" ;;
|
a|y) AutoUp="yes" ;;
|
||||||
c) CollectorTextFileDirectory="${OPTARG}"
|
c) CollectorTextFileDirectory="${OPTARG}"
|
||||||
@@ -65,6 +68,7 @@ while getopts "aynpfrhlisvmc:e:d:t:" options; do
|
|||||||
s) Stopped="-a" ;;
|
s) Stopped="-a" ;;
|
||||||
t) Timeout="${OPTARG}" ;;
|
t) Timeout="${OPTARG}" ;;
|
||||||
v) printf "%s\n" "$VERSION" ; exit 0 ;;
|
v) printf "%s\n" "$VERSION" ; exit 0 ;;
|
||||||
|
x) MaxAsync=${OPTARG} ;;
|
||||||
d) DaysOld=${OPTARG}
|
d) DaysOld=${OPTARG}
|
||||||
if ! [[ $DaysOld =~ ^[0-9]+$ ]] ; then { printf "Days -d argument given (%s) is not a number.\n" "${DaysOld}" ; exit 2 ; } ; fi ;;
|
if ! [[ $DaysOld =~ ^[0-9]+$ ]] ; then { printf "Days -d argument given (%s) is not a number.\n" "${DaysOld}" ; exit 2 ; } ; fi ;;
|
||||||
h|*) Help ; exit 2 ;;
|
h|*) Help ; exit 2 ;;
|
||||||
@@ -170,6 +174,8 @@ if [[ "$VERSION" != "$LatestRelease" ]] ; then
|
|||||||
if [[ -z "$AutoUp" ]] ; then
|
if [[ -z "$AutoUp" ]] ; then
|
||||||
read -r -p "Would you like to update? y/[n]: " SelfUpdate
|
read -r -p "Would you like to update? y/[n]: " SelfUpdate
|
||||||
[[ "$SelfUpdate" =~ [yY] ]] && self_update
|
[[ "$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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -321,11 +327,11 @@ export Excludes_string="${Excludes[@]}" # Can only export scalar variables
|
|||||||
export t_out regbin RepoUrl DaysOld
|
export t_out regbin RepoUrl DaysOld
|
||||||
|
|
||||||
# Check for POSIX xargs with -P option, fallback without async
|
# Check for POSIX xargs with -P option, fallback without async
|
||||||
if (echo "test" | xargs -P 10 >/dev/null 2>&1) ; then
|
if (echo "test" | xargs -P 2 >/dev/null 2>&1) && [[ "$MaxAsync" != 0 ]]; then
|
||||||
XargsAsync="-P $MaxAsync"
|
XargsAsync="-P $MaxAsync"
|
||||||
else
|
else
|
||||||
XargsAsync=""
|
XargsAsync=""
|
||||||
printf "%bMissing POSIX xargs, consider installing 'findutils' for asynchronous lookups.%b\n" "$c_red" "$c_reset"
|
[[ "$MaxAsync" != 0 ]] && printf "%bMissing POSIX xargs, consider installing 'findutils' for asynchronous lookups.%b\n" "$c_red" "$c_reset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Asynchronously check the image-hash of every running container VS the registry
|
# Asynchronously check the image-hash of every running container VS the registry
|
||||||
@@ -451,3 +457,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ else
|
|||||||
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
send_notification() {
|
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
CfgFile="/usr/syno/etc/synosmtp.conf"
|
CfgFile="/usr/syno/etc/synosmtp.conf"
|
||||||
|
|
||||||
# User variables:
|
# 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=$(grep 'smtp_from_mail' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||||
SenderMail=${SenderMail:-$(grep 'eventmail1' $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
|
$MailPkg $SendMailTo << __EOF
|
||||||
From: "$SenderName" <$SenderMail>
|
From: "$SenderName" <$SenderMail>
|
||||||
date:$(date -R)
|
date:$(date -R)
|
||||||
To: <$SendMailTo>
|
To: <$SendMailTo>
|
||||||
Subject: $SubjectTag Updates available on $FromHost
|
Subject: $SubjectTag $MessageTitle $FromHost
|
||||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||||
Content-Transfer-Encoding: 7bit
|
Content-Transfer-Encoding: 7bit
|
||||||
|
|
||||||
@@ -52,3 +47,28 @@ __EOF
|
|||||||
# This ensures DSM's container manager will also see the update
|
# This ensures DSM's container manager will also see the update
|
||||||
/var/packages/ContainerManager/target/tool/image_upgradable_checker
|
/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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - if API, set AppriseURL to your Apprise ip/domain.
|
# 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)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
printf "\nSending Apprise notification\n"
|
trigger_notification() {
|
||||||
|
|
||||||
MessageTitle="$FromHost - updates available."
|
### Modify to fit your setup:
|
||||||
# Setting the MessageBody variable here.
|
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
||||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
mailto://myemail:mypass@gmail.com \
|
||||||
|
mastodons://{token}@{host} \
|
||||||
# Modify to fit your setup:
|
pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \
|
||||||
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
tgram://{bot_token}/{chat_id}/
|
||||||
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
|
|
||||||
|
|
||||||
|
### 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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set DiscordWebhookUrl
|
# Modify to fit your setup - set DiscordWebhookUrl
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
DiscordWebhookUrl="PasteYourFullDiscordWebhookURL"
|
DiscordWebhookUrl="PasteYourFullDiscordWebhookURL"
|
||||||
|
|
||||||
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
||||||
|
|
||||||
curl -sS -o /dev/null --fail -X POST -H "Content-Type: application/json" -d "$MsgBody" "$DiscordWebhookUrl"
|
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.
|
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||||
# generic sample, the "Hello World" of notification addons
|
# generic sample, the "Hello World" of notification addons
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
|
||||||
|
|
||||||
FromHost=$(hostname)
|
trigger_notification() {
|
||||||
|
# Modify to fit your setup:
|
||||||
# platform specific notification code would go here
|
printf "\n$MessageTitle\n"
|
||||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
printf "\n$MessageBody\n"
|
||||||
printf "\nThe following docker containers on %s need to be updated:\n" "$FromHost"
|
}
|
||||||
printf "$UpdToString"
|
|
||||||
|
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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
GotifyToken="Your Gotify token here"
|
GotifyToken="Your Gotify token here"
|
||||||
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
||||||
@@ -25,5 +16,30 @@ send_notification() {
|
|||||||
-F "message=${MessageBody}" \
|
-F "message=${MessageBody}" \
|
||||||
-F "priority=5" \
|
-F "priority=5" \
|
||||||
-X POST "${GotifyUrl}" 1> /dev/null
|
-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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
AccessToken="Your Matrix token here"
|
AccessToken="Your Matrix token here"
|
||||||
Room_id="Enter Room_id here"
|
Room_id="Enter Room_id here"
|
||||||
@@ -22,7 +14,30 @@ send_notification() {
|
|||||||
MsgBody="{\"msgtype\":\"m.text\",\"body\":\"$MessageBody\"}"
|
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
|
# 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"
|
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
|
# Setup app and subscription at https://ntfy.sh
|
||||||
# Use your unique Topic Name in the URL below.
|
# Use your unique Topic Name in the URL below.
|
||||||
|
|
||||||
send_notification() {
|
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
printf "\nSending ntfy.sh notification\n"
|
trigger_notification() {
|
||||||
|
# Modify to fit your setup:
|
||||||
MessageTitle="$FromHost - updates available."
|
NtfyUrl="ntfy.sh/YourUniqueTopicName"
|
||||||
# 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
|
|
||||||
|
|
||||||
|
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.
|
# Requires jq installed and in PATH.
|
||||||
# Modify to fit your setup - set Url and Token.
|
# Modify to fit your setup - set Url and Token.
|
||||||
|
|
||||||
send_notification() {
|
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
trigger_notification() {
|
||||||
printf "\nSending pushbullet notification\n"
|
# Modify to fit your setup:
|
||||||
|
PushUrl="https://api.pushbullet.com/v2/pushes"
|
||||||
MessageTitle="$FromHost - updates available."
|
PushToken="Your Pushbullet token here"
|
||||||
# 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 @-
|
|
||||||
|
|
||||||
|
# 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.
|
# Requires jq installed and in PATH.
|
||||||
# Modify to fit your setup - set Url and Token.
|
# Modify to fit your setup - set Url and Token.
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
PushoverUrl="https://api.pushover.net/1/messages.json"
|
PushoverUrl="https://api.pushover.net/1/messages.json"
|
||||||
PushoverUserKey="Your Pushover User Key Here"
|
PushoverUserKey="Your Pushover User Key Here"
|
||||||
@@ -30,3 +21,29 @@ send_notification() {
|
|||||||
-F "message=$MessageBody" \
|
-F "message=$MessageBody" \
|
||||||
$PushoverUrl
|
$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
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
send_notification() {
|
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# User variables:
|
# User variables:
|
||||||
SendMailFrom="me@mydomain.tld"
|
SendMailFrom="me@mydomain.tld"
|
||||||
SendMailTo="me@mydomain.tld"
|
SendMailTo="me@mydomain.tld"
|
||||||
SubjectTag="dockcheck"
|
SubjectTag="dockcheck"
|
||||||
|
|
||||||
printf "\nSending email notification.\n"
|
|
||||||
|
|
||||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
|
||||||
|
|
||||||
$MailPkg $SendMailTo << __EOF
|
$MailPkg $SendMailTo << __EOF
|
||||||
From: "$FromHost" <$SendMailFrom>
|
From: "$FromHost" <$SendMailFrom>
|
||||||
date:$(date -R)
|
date:$(date -R)
|
||||||
To: <$SendMailTo>
|
To: <$SendMailTo>
|
||||||
Subject: [$SubjectTag] Updates available on $FromHost
|
Subject: [$SubjectTag] $MessageTitle $FromHost
|
||||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||||
Content-Transfer-Encoding: 7bit
|
Content-Transfer-Encoding: 7bit
|
||||||
|
|
||||||
@@ -42,3 +36,28 @@ $MessageBody
|
|||||||
|
|
||||||
__EOF
|
__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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set TelegramChatId and TelegramToken.
|
# Modify to fit your setup - set TelegramChatId and TelegramToken.
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
TelegramToken="Your Telegram token here"
|
TelegramToken="Your Telegram token here"
|
||||||
TelegramChatId="Your Telegram ChatId 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}"
|
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"
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user