mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e92a3a4cb | ||
|
|
9ead0feb9f | ||
|
|
2e620cd2c0 | ||
|
|
fc7b2888f1 | ||
|
|
e15a8e9dbf | ||
|
|
342ff271ca | ||
|
|
3f56af0c8a | ||
|
|
ab3aaf1140 |
@@ -16,6 +16,7 @@
|
||||
|
||||
|
||||
### :bell: Recent changes
|
||||
- **v0.3.2**: Added a notify function to wrap a notify-script, currently DSM/Ssmtp + template script.
|
||||
- **v0.3.1**: Addded option `-m` , monochrome mode - no printf color codes.
|
||||
- **v0.3.0**: Added option `-d N`, age (days) new images have to be before being pulled and updated.
|
||||
- **v0.2.6**: regctl check / download logic changed. Now using the scripts directory as primary location.
|
||||
@@ -74,6 +75,10 @@ Enter number(s) separated by comma, [a] for all - [q] to quit:
|
||||
Then it proceedes to run `pull` and `up -d` on every container with updates.
|
||||
After the updates are complete, you'll get prompted if you'd like to prune dangling images.
|
||||
|
||||
### Notifications:
|
||||
|
||||
A simple email notification function is added, with a generic example and DSM/Ssmtp script by [yoyoma2](https://github.com/yoyoma2). Further addons are welcome, suggestions or PR!
|
||||
|
||||
### :warning: `-r flag` disclaimer and warning
|
||||
**Wont auto-update the containers, only their images. (compose is recommended)**
|
||||
`docker run` dont support using new images just by restarting a container.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION="v0.3.1"
|
||||
### ChangeNotes: Added feature (-m) Monochrome Mode, no printf color codes.
|
||||
VERSION="v0.3.2"
|
||||
### ChangeNotes: Added a notify function - template and email script (DSM etc)
|
||||
Github="https://github.com/mag37/dockcheck"
|
||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||
|
||||
@@ -14,6 +14,8 @@ ScriptWorkDir="$(dirname "$ScriptPath")"
|
||||
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")"
|
||||
|
||||
[ -s $ScriptWorkDir/notify.sh ] && source $ScriptWorkDir/notify.sh
|
||||
|
||||
### Help Function:
|
||||
Help() {
|
||||
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
||||
@@ -232,6 +234,7 @@ fi
|
||||
if [[ -n ${GotUpdates[*]} ]] ; then
|
||||
printf "\n%bContainers with updates available:%b\n" "$c_yellow" "$c_reset"
|
||||
[[ -z "$AutoUp" ]] && options || printf "%s\n" "${GotUpdates[@]}"
|
||||
[[ $(type -t send_notification) == function ]] && send_notification "${GotUpdates[@]}"
|
||||
fi
|
||||
|
||||
### Optionally get updates if there's any
|
||||
|
||||
29
notify_DSM.sh
Normal file
29
notify_DSM.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 email notifications on synology DSM
|
||||
# Modify to your liking - changing SendMailTo and Subject and content.
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
# change this to your usual destination for synology DSM notification emails
|
||||
SendMailTo=me@mydomain.com
|
||||
FromHost=$(hostname)
|
||||
|
||||
printf "\nSending email notification\n"
|
||||
|
||||
ssmtp $SendMailTo << __EOF
|
||||
From: "$FromHost" <$SendMailTo>
|
||||
date:$(date -R)
|
||||
To: <$SendMailTo>
|
||||
Subject: [diskstation] Some docker containers need to be updated
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
The following docker containers on $FromHost need to be updated:
|
||||
|
||||
$UpdToString
|
||||
|
||||
From $FromHost
|
||||
|
||||
__EOF
|
||||
}
|
||||
13
notify_generic.sh
Normal file
13
notify_generic.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
# Copy/rename this file to notify.sh to enable email/text notifications
|
||||
# generic sample, the "Hello World" of notification addons
|
||||
|
||||
send_notification() {
|
||||
Updates=("$@")
|
||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
||||
printf "\nThe following docker containers on %s need to be updated:\n%s\n" "$FromHost" "$UpdToString"
|
||||
}
|
||||
Reference in New Issue
Block a user