mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
new notification structure
This commit is contained in:
parent
1548b03a9e
commit
71967277aa
6 changed files with 123 additions and 68 deletions
|
|
@ -59,7 +59,6 @@ MessageTitle="Updates available on"
|
|||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||
|
||||
trigger_notification
|
||||
|
||||
}
|
||||
|
||||
### Remove or comment out the following function
|
||||
|
|
@ -72,5 +71,4 @@ MessageTitle="New version of dockcheck available on"
|
|||
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||
|
||||
trigger_notification
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,43 +8,40 @@ FromHost=$(hostname)
|
|||
|
||||
trigger_notification() {
|
||||
|
||||
### Modify to fit your setup:
|
||||
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
||||
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
|
||||
### Modify to fit your setup:
|
||||
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
||||
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
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
printf "\nSending Apprise notification\n"
|
||||
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
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
|
||||
trigger_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"
|
||||
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
|
||||
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.
|
||||
# Modify to fit your setup - set DiscordWebhookUrl
|
||||
|
||||
send_notification() {
|
||||
[ -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"
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
DiscordWebhookUrl="PasteYourFullDiscordWebhookURL"
|
||||
|
||||
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
### 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,36 @@
|
|||
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||
# generic sample, the "Hello World" of notification addons
|
||||
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
|
||||
printf "\n$MessageTitle\n"
|
||||
printf "\n$MessageBody\n"
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || 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" "$FromHost"
|
||||
printf "$UpdToString"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
|
||||
trigger_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.
|
||||
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
||||
|
||||
send_notification() {
|
||||
[ -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"
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
GotifyToken="Your Gotify token here"
|
||||
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
||||
|
|
@ -25,5 +16,30 @@ send_notification() {
|
|||
-F "message=${MessageBody}" \
|
||||
-F "priority=5" \
|
||||
-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
|
||||
}
|
||||
|
||||
### 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,17 +4,9 @@
|
|||
# Required receiving services must already be set up.
|
||||
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
||||
|
||||
send_notification() {
|
||||
[ -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"
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
AccessToken="Your Matrix token here"
|
||||
Room_id="Enter Room_id here"
|
||||
|
|
@ -22,7 +14,30 @@ send_notification() {
|
|||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
### 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue