mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
319b43bc1b | ||
|
|
8b40dce2cd | ||
|
|
62b52796f2 | ||
|
|
85ee721cd1 | ||
|
|
6de00a2b90 | ||
|
|
a550994659 | ||
|
|
0e3210b561 | ||
|
|
db4431d40a | ||
|
|
9f8c62ed96 | ||
|
|
827bb7e14a | ||
|
|
91ff4aaaa7 | ||
|
|
999694985a | ||
|
|
640046668c | ||
|
|
a79de24bcc | ||
|
|
f31a886424 | ||
|
|
5b31e68f73 | ||
|
|
923736c413 | ||
|
|
7d825f36c9 | ||
|
|
29dffbb9b3 | ||
|
|
588c22afc9 | ||
|
|
39c69b7648 | ||
|
|
35e33b3997 | ||
|
|
a615d759ad | ||
|
|
df310c8f50 | ||
|
|
b1448fbb95 | ||
|
|
de67cab998 | ||
|
|
608c218281 | ||
|
|
3d122f2b86 | ||
|
|
8e280145b9 | ||
|
|
da389a04e7 | ||
|
|
25563d16b6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
# ignore users custom notify.sh
|
# ignore users custom notify.sh
|
||||||
/notify.sh
|
/notify.sh
|
||||||
|
/urls.list
|
||||||
# ignore the auto-installed regctl
|
# ignore the auto-installed regctl
|
||||||
regctl
|
regctl
|
||||||
|
|||||||
11
.pre-commit-config.yaml
Normal file
11
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.6.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: check-added-large-files
|
||||||
|
- id: trailing-whitespace
|
||||||
|
args: [--markdown-linebreak-ext=md]
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: mixed-line-ending
|
||||||
|
args: ['--fix=lf']
|
||||||
45
README.md
45
README.md
@@ -17,15 +17,12 @@
|
|||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
|
||||||
|
- **v0.4.9**: Added a function to enrich the notify-message with release note URLs. See [Release notes addon](https://github.com/mag37/dockcheck#date-release-notes-addon-to-notifications)
|
||||||
|
- **v0.4.8**: Rewrote prune logic to not prompt with options `-a|-y` or `-n`. Auto prune with `-p`.
|
||||||
|
- **v0.4.7**: Notification Template changes to gotify(new!), DSM(improved), SMTP(deprecation alternative).
|
||||||
- **v0.4.6**: Compatibility changes to timeout, due to busybox.
|
- **v0.4.6**: Compatibility changes to timeout, due to busybox.
|
||||||
- **v0.4.5**: Bugfixes, compatibility changes to timeout and arrays.
|
- **v0.4.5**: Bugfixes, compatibility changes to timeout and arrays.
|
||||||
- **v0.4.3**: Added timeout option to skip container if registry check takes too long (10s default).
|
- **v0.4.3**: Added timeout option to skip container if registry check takes too long (10s default).
|
||||||
- **v0.4.1**: Syntax and logic cleanups, bugfixes on multi compose and env-files.
|
|
||||||
- **v0.4.0**: Reworked selfupdate (auto git/curl/wget), general syntax cleanup, added -v for version.
|
|
||||||
- **v0.3.8**: Fixed `--env-file` logic to work with multiple env-files.
|
|
||||||
- **v0.3.7**: Added support for [labels](#bookmark-labels), added the `-f` option (force restart stack).
|
|
||||||
- **v0.3.6**: Added pushbullet template.
|
|
||||||
- **v0.3.5**: Added a simple progress bar for the registry checkup.
|
|
||||||
___
|
___
|
||||||
|
|
||||||
|
|
||||||
@@ -101,21 +98,36 @@ Add preferred `notify.sh`-template to the same directory - this will not be touc
|
|||||||
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!
|
||||||
|
|
||||||
Use a `notify_X.sh` template file, copy it to `notify.sh`, modify it to your needs!
|
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:**
|
||||||
- Synology [DSM](https://www.synology.com/en-global/dsm)
|
- Synology [DSM](https://www.synology.com/en-global/dsm)
|
||||||
- Email with [sSMTP](https://wiki.debian.org/sSMTP)
|
- Email with [mSMTP](https://wiki.debian.org/msmtp) (or deprecated alternative [sSMTP](https://wiki.debian.org/sSMTP))
|
||||||
- Apprise (with it's [multitude](https://github.com/caronc/apprise#supported-notifications) of notifications)
|
- Apprise (with it's [multitude](https://github.com/caronc/apprise#supported-notifications) of notifications)
|
||||||
- both native [caronc/apprise](https://github.com/caronc/apprise) and the standalone [linuxserver/docker-apprise-api](https://github.com/linuxserver/docker-apprise-api)
|
- both native [caronc/apprise](https://github.com/caronc/apprise) and the standalone [linuxserver/docker-apprise-api](https://github.com/linuxserver/docker-apprise-api)
|
||||||
- Read the [QuickStart](extras/apprise_quickstart.md)
|
- Read the [QuickStart](extras/apprise_quickstart.md)
|
||||||
- [ntfy.sh](https://ntfy.sh/) - HTTP-based pub-sub notifications.
|
- [ntfy.sh](https://ntfy.sh/) - HTTP-based pub-sub notifications.
|
||||||
|
- [Gotify](https://gotify.net/) - a simple server for sending and receiving messages.
|
||||||
- [Pushbullet](https://www.pushbullet.com/) - connecting different devices with cross-platform features.
|
- [Pushbullet](https://www.pushbullet.com/) - connecting different devices with cross-platform features.
|
||||||
- [Telegram](https://telegram.org/) - Telegram chat API.
|
- [Telegram](https://telegram.org/) - Telegram chat API.
|
||||||
- [Matrix-Synapse](https://github.com/element-hq/synapse) - [Matrix](https://matrix.org/), open, secure, decentralised communication.
|
- [Matrix-Synapse](https://github.com/element-hq/synapse) - [Matrix](https://matrix.org/), open, secure, decentralised communication.
|
||||||
|
- [Pushover](https://pushover.net/) - Simple Notifications (to your phone, wearables, desktops)
|
||||||
|
|
||||||
Further additions are welcome - suggestions or PR!
|
Further additions are welcome - suggestions or PR!
|
||||||
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>
|
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>
|
||||||
|
|
||||||
|
### :date: Release notes addon to Notifications
|
||||||
|
There's a function to use a lookup-file to add release note URL's to the notification message.
|
||||||
|
Copy the notify_templates/`urls.list` file to the script directory and modify it as necessary, it will be used automatically if it's there.
|
||||||
|
The output of the notification will look something like this:
|
||||||
|
```
|
||||||
|
Containers on hostname with updates available:
|
||||||
|
apprise-api -> https://github.com/linuxserver/docker-apprise-api/releases
|
||||||
|
homer -> https://github.com/bastienwirtz/homer/releases
|
||||||
|
nginx -> https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||||
|
...
|
||||||
|
```
|
||||||
|
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.
|
||||||
|
|
||||||
## :bookmark: Labels
|
## :bookmark: Labels
|
||||||
Optionally add labels to compose-files. Currently these are the usable labels:
|
Optionally add labels to compose-files. Currently these are the usable labels:
|
||||||
```
|
```
|
||||||
@@ -158,21 +170,26 @@ function dchk {
|
|||||||
## :hammer: Known issues
|
## :hammer: Known issues
|
||||||
- No detailed error feedback (just skip + list what's skipped).
|
- No detailed error feedback (just skip + list what's skipped).
|
||||||
- Not respecting `--profile` options when re-creating the container.
|
- Not respecting `--profile` options when re-creating the container.
|
||||||
- Not working well with containers created by Portainer.
|
- Not working well with containers created by **Portainer**.
|
||||||
|
- **Watchtower** might cause issues due to retagging images when checking for updates (and thereby pulling new images).
|
||||||
|
|
||||||
## :warning: `-r flag` disclaimer and warning
|
## :warning: `-r flag` disclaimer and warning
|
||||||
**Wont auto-update the containers, only their images. (compose is recommended)**
|
**Wont auto-update the containers, only their images. (compose is recommended)**
|
||||||
`docker run` dont support using new images just by restarting a container.
|
`docker run` dont support using new images just by restarting a container.
|
||||||
Containers need to be manually stopped, removed and created again to run on the new image.
|
Containers need to be manually stopped, removed and created again to run on the new image.
|
||||||
|
|
||||||
|
## :wrench: Debugging
|
||||||
|
If you hit issues, you could check the output of the `extras/errorCheck.sh` script for clues.
|
||||||
|
Another option is to run the main script with debugging in a subshell `bash -x dockcheck.sh` - if there's a particular container/image that's causing issues you can filter for just that through `bash -x dockcheck.sh nginx`.
|
||||||
|
|
||||||
## :scroll: License
|
## :scroll: License
|
||||||
dockcheck is created and released under the [GNU GPL v3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html) license.
|
dockcheck is created and released under the [GNU GPL v3.0](https://www.gnu.org/licenses/gpl-3.0-standalone.html) license.
|
||||||
|
|
||||||
### :floppy_disk: The [story](https://mag37.org/posts/project_dockcheck/) behind it. 1 year in retrospect.
|
## :heartpulse: Sponsorlist
|
||||||
|
|
||||||
|
- [avegy](https://github.com/avegy)
|
||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
|
### :floppy_disk: The [story](https://mag37.org/posts/project_dockcheck/) behind it. 1 year in retrospect.
|
||||||
|
|
||||||
## Special Thanks
|
|
||||||
- :bison: [t0rnis](https://github.com/t0rnis)
|
|
||||||
- :leopard: [Palleri](https://github.com/Palleri)
|
|
||||||
|
|||||||
22
dockcheck.sh
22
dockcheck.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.4.6"
|
VERSION="v0.4.9"
|
||||||
### ChangeNotes: Compatability changes due to busyboxs timemout.
|
### ChangeNotes: Added a function to enrich the notify-message with release note URLs. See README.
|
||||||
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,7 +13,6 @@ 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")"
|
||||||
|
|
||||||
|
|
||||||
### 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 +33,8 @@ 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
|
||||||
|
echo "Project source: $Github"
|
||||||
}
|
}
|
||||||
|
|
||||||
### Colors:
|
### Colors:
|
||||||
@@ -146,6 +147,17 @@ progress_bar() {
|
|||||||
[[ "$QueTotal" == "$QueCurrent" ]] && printf "\r[%b%s%b] %s/%s \n" "$c_teal" "$BarComplete" "$c_reset" "$QueCurrent" "$QueTotal"
|
[[ "$QueTotal" == "$QueCurrent" ]] && printf "\r[%b%s%b] %s/%s \n" "$c_teal" "$BarComplete" "$c_reset" "$QueCurrent" "$QueTotal"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Function to add user-provided urls to releasenotes
|
||||||
|
releasenotes() {
|
||||||
|
for update in ${Updates[@]}; do
|
||||||
|
found=false
|
||||||
|
while read -r container url; do
|
||||||
|
[[ $update == $container ]] && printf "%s -> %s\n" "$update" "$url" && found=true
|
||||||
|
done < "$ScriptWorkDir"/urls.list
|
||||||
|
[[ $found == false ]] && printf "%s -> url missing\n" "$update" || continue
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
### Version check & initiate self update
|
### Version check & initiate self update
|
||||||
if [[ "$VERSION" != "$LatestRelease" ]] ; then
|
if [[ "$VERSION" != "$LatestRelease" ]] ; then
|
||||||
printf "New version available! %b%s%b ⇒ %b%s%b \n Change Notes: %s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges"
|
printf "New version available! %b%s%b ⇒ %b%s%b \n Change Notes: %s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges"
|
||||||
@@ -259,7 +271,6 @@ NoUpdates=($(sort <<<"${NoUpdates[*]}"))
|
|||||||
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
|
|
||||||
### Define how many updates are available
|
### Define how many updates are available
|
||||||
UpdCount="${#GotUpdates[@]}"
|
UpdCount="${#GotUpdates[@]}"
|
||||||
|
|
||||||
@@ -333,7 +344,7 @@ if [ -n "$GotUpdates" ] ; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf "\n%bAll done!%b\n" "$c_green" "$c_reset"
|
printf "\n%bAll done!%b\n" "$c_green" "$c_reset"
|
||||||
[[ -z "$AutoPrune" ]] && read -r -p "Would you like to prune dangling images? y/[n]: " AutoPrune
|
if [[ -z "$AutoPrune" ]] && [[ -z "$AutoUp" ]]; then read -r -p "Would you like to prune dangling images? y/[n]: " AutoPrune ; fi
|
||||||
[[ "$AutoPrune" =~ [yY] ]] && docker image prune -f
|
[[ "$AutoPrune" =~ [yY] ]] && docker image prune -f
|
||||||
else
|
else
|
||||||
printf "\nNo updates installed, exiting.\n"
|
printf "\nNo updates installed, exiting.\n"
|
||||||
@@ -343,4 +354,3 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
|
||||||
#
|
|
||||||
# Copy/rename this file to notify.sh to enable email notifications on Synology DSM
|
|
||||||
# DSM Notification Email has to be configured manually.
|
|
||||||
# Modify to your liking - changing SendMailTo and Subject and content.
|
|
||||||
|
|
||||||
send_notification() {
|
|
||||||
Updates=("$@")
|
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
|
||||||
FromHost=$(hostname)
|
|
||||||
|
|
||||||
# User variables:
|
|
||||||
# change this to your usual destination for synology DSM notification emails
|
|
||||||
SendMailTo="me@mydomain.com"
|
|
||||||
SubjectTag="diskstation"
|
|
||||||
|
|
||||||
printf "\nSending email notification.\n"
|
|
||||||
|
|
||||||
ssmtp $SendMailTo << __EOF
|
|
||||||
From: "$FromHost" <$SendMailTo>
|
|
||||||
date:$(date -R)
|
|
||||||
To: <$SendMailTo>
|
|
||||||
Subject: [$SubjectTag] Updates available on $FromHost
|
|
||||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
|
||||||
Content-Transfer-Encoding: 7bit
|
|
||||||
|
|
||||||
The following containers on $FromHost have updates available:
|
|
||||||
|
|
||||||
$UpdToString
|
|
||||||
|
|
||||||
From $FromHost
|
|
||||||
|
|
||||||
__EOF
|
|
||||||
}
|
|
||||||
53
notify_templates/notify_DSM.sh
Normal file
53
notify_templates/notify_DSM.sh
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||||
|
#
|
||||||
|
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||||
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
|
# The existing DSM Notification Email configuration will be used automatically.
|
||||||
|
# Modify to your liking - changing SendMailTo and Subject and content.
|
||||||
|
|
||||||
|
MSMTP=$(which msmtp)
|
||||||
|
SSMTP=$(which ssmtp)
|
||||||
|
|
||||||
|
if [ -n "$MSMPT" ] ; then
|
||||||
|
MailPkg=$MSMTP
|
||||||
|
elif [ -n "$SSMTP" ] ; then
|
||||||
|
MailPkg=$SSMTP
|
||||||
|
else
|
||||||
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
send_notification() {
|
||||||
|
Updates=("$@")
|
||||||
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
|
FromHost=$(hostname)
|
||||||
|
CfgFile="/usr/syno/etc/synosmtp.conf"
|
||||||
|
|
||||||
|
# User variables:
|
||||||
|
# Automatically sends to your usual destination for synology DSM notification emails.
|
||||||
|
# You can also manually override by assigning something else to SendMailTo below.
|
||||||
|
SendMailTo=$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||||
|
#SendMailTo="me@mydomain.com"
|
||||||
|
|
||||||
|
SubjectTag=$(grep 'eventsubjectprefix' $CfgFile | sed -n 's/.*"\([^"]*\)".*/\1/p')
|
||||||
|
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"
|
||||||
|
|
||||||
|
$MailPkg $SendMailTo << __EOF
|
||||||
|
From: "$SenderName" <$SenderMail>
|
||||||
|
date:$(date -R)
|
||||||
|
To: <$SendMailTo>
|
||||||
|
Subject: $SubjectTag Updates available on $FromHost
|
||||||
|
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
|
||||||
|
The following containers on $FromHost have updates available:
|
||||||
|
|
||||||
|
$UpdToString
|
||||||
|
|
||||||
|
From $SenderName
|
||||||
|
__EOF
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
printf "\nSending Apprise notification\n"
|
printf "\nSending Apprise notification\n"
|
||||||
@@ -33,5 +33,3 @@ apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
|||||||
# curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL
|
# curl -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
29
notify_templates/notify_gotify.sh
Normal file
29
notify_templates/notify_gotify.sh
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
#
|
||||||
|
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||||
|
# Required receiving services must already be set up.
|
||||||
|
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
||||||
|
|
||||||
|
send_notification() {
|
||||||
|
Updates=("$@")
|
||||||
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || 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."
|
||||||
|
MessageBody="Containers on ${FromHost} with updates available: ${UpdToString}"
|
||||||
|
|
||||||
|
# Modify to fit your setup:
|
||||||
|
GotifyToken="Your Gotify token here"
|
||||||
|
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
||||||
|
|
||||||
|
curl \
|
||||||
|
-F "title=${MessageTitle}" \
|
||||||
|
-F "message=${MessageBody}" \
|
||||||
|
-F "priority=5" \
|
||||||
|
-X POST "${GotifyUrl}" &> /dev/null
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
printf "\nSending ntfy.sh notification\n"
|
printf "\nSending ntfy.sh notification\n"
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
32
notify_templates/notify_pushover.sh
Normal file
32
notify_templates/notify_pushover.sh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
#
|
||||||
|
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||||
|
# Required receiving services must already be set up.
|
||||||
|
# Requires jq installed and in PATH.
|
||||||
|
# Modify to fit your setup - set Url and Token.
|
||||||
|
|
||||||
|
send_notification() {
|
||||||
|
Updates=("$@")
|
||||||
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || 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.
|
||||||
|
MessageBody="Containers on $FromHost with updates available: $UpdToString"
|
||||||
|
|
||||||
|
# Modify to fit your setup:
|
||||||
|
PushoverUrl="https://api.pushover.net/1/messages.json"
|
||||||
|
PushoverUserKey="Your Pushover User Key Here"
|
||||||
|
PushoverToken="Your Pushover API Token Here"
|
||||||
|
|
||||||
|
# Sending the notification via Pushover
|
||||||
|
curl -sS -o /dev/null --show-error --fail -X POST \
|
||||||
|
-F "token=$PushoverToken" \
|
||||||
|
-F "user=$PushoverUserKey" \
|
||||||
|
-F "title=$MessageTitle" \
|
||||||
|
-F "message=$MessageBody" \
|
||||||
|
$PushoverUrl
|
||||||
|
}
|
||||||
@@ -1,12 +1,24 @@
|
|||||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||||
|
# INFO: ssmtp is depcerated - consider to use msmtp instead.
|
||||||
#
|
#
|
||||||
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
# Copy/rename this file to notify.sh to enable the notification snipppet.
|
||||||
# sSMTP has to be installed and configured manually.
|
# mSMTP/sSMTP has to be installed and configured manually.
|
||||||
# Modify to fit your setup - changing SendMailFrom, SendMailTo, SubjectTag
|
# Modify to fit your setup - changing SendMailFrom, SendMailTo, SubjectTag
|
||||||
|
|
||||||
|
MSMTP=$(which msmtp)
|
||||||
|
SSMTP=$(which ssmtp)
|
||||||
|
|
||||||
|
if [ -n "$MSMPT" ] ; then
|
||||||
|
MailPkg=$MSMTP
|
||||||
|
elif [ -n "$SSMTP" ] ; then
|
||||||
|
MailPkg=$SSMTP
|
||||||
|
else
|
||||||
|
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# User variables:
|
# User variables:
|
||||||
@@ -16,7 +28,7 @@ SubjectTag="dockcheck"
|
|||||||
|
|
||||||
printf "\nSending email notification.\n"
|
printf "\nSending email notification.\n"
|
||||||
|
|
||||||
ssmtp $SendMailTo << __EOF
|
$MailPkg $SendMailTo << __EOF
|
||||||
From: "$FromHost" <$SendMailFrom>
|
From: "$FromHost" <$SendMailFrom>
|
||||||
date:$(date -R)
|
date:$(date -R)
|
||||||
To: <$SendMailTo>
|
To: <$SendMailTo>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
8
notify_templates/urls.list
Normal file
8
notify_templates/urls.list
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# This is a list of container names and releasenote urls, separated by space.
|
||||||
|
# Modify, add and (if necessary) remove to fit your needs.
|
||||||
|
# Additions are welcome! Append your list to the git-repo, use generic names and sensible urls.
|
||||||
|
|
||||||
|
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
||||||
|
homer https://github.com/bastienwirtz/homer/releases
|
||||||
|
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||||
|
vaultwarden-server https://github.com/dani-garcia/vaultwarden/releases
|
||||||
Reference in New Issue
Block a user