mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 15:58:13 +01:00
Added option -i
This commit is contained in:
parent
3053304356
commit
47ebb75691
2 changed files with 15 additions and 12 deletions
13
README.md
13
README.md
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
### :bell: Recent changes
|
### :bell: Recent changes
|
||||||
- **v0.3.3**: Notification tweaks, added Apprise template.
|
- **v0.3.3**: Added Apprise template and the option `-i` inform - to send notifications.
|
||||||
- **v0.3.2**: Added a notify function to wrap a notify-script, currently DSM/Ssmtp + template script.
|
- **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.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.3.0**: Added option `-d N`, age (days) new images have to be before being pulled and updated.
|
||||||
|
|
@ -47,14 +47,16 @@ $ ./dockcheck.sh -h
|
||||||
Example: dockcheck.sh -y -d 10 -e nextcloud,heimdall
|
Example: dockcheck.sh -y -d 10 -e nextcloud,heimdall
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h Print this Help.
|
|
||||||
-a|y Automatic updates, without interaction.
|
-a|y Automatic updates, without interaction.
|
||||||
-n No updates, only checking availability.
|
-d N Only update to new images that are N+ days old. Lists too recent with +prefix and age. 2xSlower.
|
||||||
-e X Exclude containers, separated by comma.
|
-e X Exclude containers, separated by comma.
|
||||||
-d N Only update to new images that are N+ days old. Lists too recent with +prefix. 2xSlower.
|
-h Print this Help.
|
||||||
|
-i Inform - send a preconfigured notification.
|
||||||
|
-m Monochrome mode, no printf color codes.
|
||||||
|
-n No updates, only checking availability.
|
||||||
-p Auto-Prune dangling images after update.
|
-p Auto-Prune dangling images after update.
|
||||||
-r Allow updating images for docker run, wont update the container.
|
-r Allow updating images for docker run, wont update the container.
|
||||||
-s Include stopped containers in the check. (Logic: docker ps -a).
|
-s Include stopped containers in the check. (Logic: docker ps -a)
|
||||||
```
|
```
|
||||||
|
|
||||||
Basic example:
|
Basic example:
|
||||||
|
|
@ -77,6 +79,7 @@ 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.
|
After the updates are complete, you'll get prompted if you'd like to prune dangling images.
|
||||||
|
|
||||||
### :loudspeaker: Notifications
|
### :loudspeaker: Notifications
|
||||||
|
Trigger with the `-i` flag.
|
||||||
|
|
||||||
Use a `notify_X.sh` template file, copy it to `notify.sh`, modify it to your needs!
|
Use a `notify_X.sh` template file, copy it to `notify.sh`, modify it to your needs!
|
||||||
Current templates:
|
Current templates:
|
||||||
|
|
|
||||||
12
dockcheck.sh
12
dockcheck.sh
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.3.2"
|
VERSION="v0.3.3"
|
||||||
### ChangeNotes: Added a notify function - template and email script (DSM etc)
|
### ChangeNotes: Added option -i, inform - notify. Added Appraise template.
|
||||||
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"
|
||||||
|
|
||||||
|
|
@ -14,7 +14,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")"
|
||||||
|
|
||||||
[ -s $ScriptWorkDir/notify.sh ] && source $ScriptWorkDir/notify.sh
|
|
||||||
|
|
||||||
### Help Function:
|
### Help Function:
|
||||||
Help() {
|
Help() {
|
||||||
|
|
@ -26,6 +25,7 @@ Help() {
|
||||||
echo "-d N Only update to new images that are N+ days old. Lists too recent with +prefix and age. 2xSlower."
|
echo "-d N Only update to new images that are N+ days old. Lists too recent with +prefix and age. 2xSlower."
|
||||||
echo "-e X Exclude containers, separated by comma."
|
echo "-e X Exclude containers, separated by comma."
|
||||||
echo "-h Print this Help."
|
echo "-h Print this Help."
|
||||||
|
echo "-i Inform - send a preconfigured notification."
|
||||||
echo "-m Monochrome mode, no printf color codes."
|
echo "-m Monochrome mode, no printf color codes."
|
||||||
echo "-n No updates, only checking availability."
|
echo "-n No updates, only checking availability."
|
||||||
echo "-p Auto-Prune dangling images after update."
|
echo "-p Auto-Prune dangling images after update."
|
||||||
|
|
@ -41,14 +41,14 @@ c_blue="\033[0;34m"
|
||||||
c_teal="\033[0;36m"
|
c_teal="\033[0;36m"
|
||||||
c_reset="\033[0m"
|
c_reset="\033[0m"
|
||||||
|
|
||||||
|
|
||||||
Stopped=""
|
Stopped=""
|
||||||
while getopts "aynprhsme:d:" options; do
|
while getopts "aynprhisme:d:" options; do
|
||||||
case "${options}" in
|
case "${options}" in
|
||||||
a|y) AutoUp="yes" ;;
|
a|y) AutoUp="yes" ;;
|
||||||
n) AutoUp="no" ;;
|
n) AutoUp="no" ;;
|
||||||
r) DRunUp="yes" ;;
|
r) DRunUp="yes" ;;
|
||||||
p) AutoPrune="yes" ;;
|
p) AutoPrune="yes" ;;
|
||||||
|
i) [ -s $ScriptWorkDir/notify.sh ] && { source $ScriptWorkDir/notify.sh ; Notify="yes" ; } ;;
|
||||||
e) Exclude=${OPTARG} ;;
|
e) Exclude=${OPTARG} ;;
|
||||||
m) declare c_{red,green,yellow,blue,teal,reset}="" ;;
|
m) declare c_{red,green,yellow,blue,teal,reset}="" ;;
|
||||||
s) Stopped="-a" ;;
|
s) Stopped="-a" ;;
|
||||||
|
|
@ -234,7 +234,7 @@ fi
|
||||||
if [[ -n ${GotUpdates[*]} ]] ; then
|
if [[ -n ${GotUpdates[*]} ]] ; then
|
||||||
printf "\n%bContainers with updates available:%b\n" "$c_yellow" "$c_reset"
|
printf "\n%bContainers with updates available:%b\n" "$c_yellow" "$c_reset"
|
||||||
[[ -z "$AutoUp" ]] && options || printf "%s\n" "${GotUpdates[@]}"
|
[[ -z "$AutoUp" ]] && options || printf "%s\n" "${GotUpdates[@]}"
|
||||||
[[ $(type -t send_notification) == function ]] && send_notification "${GotUpdates[@]}"
|
[[ ! -z "$Notify" ]] && { [[ $(type -t send_notification) == function ]] && send_notification "${GotUpdates[@]}" || printf "Could not source notification function.\n" ; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Optionally get updates if there's any
|
### Optionally get updates if there's any
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue