mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 09:57:49 +00:00
add a sample a DSM notification addon
This commit is contained in:
@@ -14,6 +14,8 @@ 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() {
|
||||||
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
||||||
@@ -232,6 +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[@]}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Optionally get updates if there's any
|
### Optionally get updates if there's any
|
||||||
|
|||||||
25
notify_DSM.sh
Normal file
25
notify_DSM.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# copy/rename this file to notify.sh to enable email notifications on synology DSM
|
||||||
|
|
||||||
|
send_notification() {
|
||||||
|
|
||||||
|
# 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 packages need to be updated
|
||||||
|
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
|
||||||
|
The following docker packages on $FromHost need to be updated:
|
||||||
|
|
||||||
|
$@
|
||||||
|
|
||||||
|
From $FromHost
|
||||||
|
__EOF
|
||||||
|
}
|
||||||
12
notify_generic.sh
Normal file
12
notify_generic.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# copy/rename this file to notify.sh to enable email/text notifications
|
||||||
|
# generic sample, the "Hello World" of notification addons
|
||||||
|
|
||||||
|
send_notification() {
|
||||||
|
|
||||||
|
FromHost=$(hostname)
|
||||||
|
|
||||||
|
# platform specific notification code would go here
|
||||||
|
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
||||||
|
printf "\nThe following docker packages on $FromHost need to be updated:\n$@\n"
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user