mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-19 02:47:45 +00:00
new notification structure
This commit is contained in:
@@ -59,7 +59,6 @@ MessageTitle="Updates available on"
|
|||||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||||
|
|
||||||
trigger_notification
|
trigger_notification
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### Remove or comment out the following function
|
### 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"
|
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||||
|
|
||||||
trigger_notification
|
trigger_notification
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,43 +8,40 @@ FromHost=$(hostname)
|
|||||||
|
|
||||||
trigger_notification() {
|
trigger_notification() {
|
||||||
|
|
||||||
### Modify to fit your setup:
|
### Modify to fit your setup:
|
||||||
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
apprise -vv -t "$MessageTitle" -b "$MessageBody" \
|
||||||
mailto://myemail:mypass@gmail.com \
|
mailto://myemail:mypass@gmail.com \
|
||||||
mastodons://{token}@{host} \
|
mastodons://{token}@{host} \
|
||||||
pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \
|
pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \
|
||||||
tgram://{bot_token}/{chat_id}/
|
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
|
|
||||||
|
|
||||||
|
### 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() {
|
send_notification() {
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||||
|
|
||||||
printf "\nSending Apprise notification\n"
|
printf "\nSending Apprise notification\n"
|
||||||
|
|
||||||
MessageTitle="$FromHost - updates available."
|
MessageTitle="$FromHost - updates available."
|
||||||
# Setting the MessageBody variable here.
|
# Setting the MessageBody variable here.
|
||||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||||
|
|
||||||
trigger_notification
|
|
||||||
|
|
||||||
|
trigger_notification
|
||||||
}
|
}
|
||||||
|
|
||||||
### Remove or comment out the following function
|
### Remove or comment out the following function
|
||||||
### to not send notifications when dockcheck itself has updates.
|
### to not send notifications when dockcheck itself has updates.
|
||||||
dockcheck_notification() {
|
dockcheck_notification() {
|
||||||
printf "\nSending Apprise dockcheck notification\n"
|
printf "\nSending Apprise dockcheck notification\n"
|
||||||
|
|
||||||
MessageTitle="$FromHost - New version of dockcheck available."
|
MessageTitle="$FromHost - New version of dockcheck available."
|
||||||
# Setting the MessageBody variable here.
|
# Setting the MessageBody variable here.
|
||||||
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||||
|
|
||||||
trigger_notification
|
|
||||||
|
|
||||||
|
trigger_notification
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,25 +4,32 @@
|
|||||||
# Required receiving services must already be set up.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set DiscordWebhookUrl
|
# Modify to fit your setup - set DiscordWebhookUrl
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
DiscordWebhookUrl="PasteYourFullDiscordWebhookURL"
|
DiscordWebhookUrl="PasteYourFullDiscordWebhookURL"
|
||||||
|
|
||||||
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
MsgBody="{\"username\":\"$FromHost\",\"content\":\"$MessageBody\"}"
|
||||||
|
|
||||||
curl -sS -o /dev/null --fail -X POST -H "Content-Type: application/json" -d "$MsgBody" "$DiscordWebhookUrl"
|
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.
|
# Copy/rename this file to notify.sh to enable the notification snippet.
|
||||||
# generic sample, the "Hello World" of notification addons
|
# generic sample, the "Hello World" of notification addons
|
||||||
|
|
||||||
|
FromHost=$(hostname)
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
|
|
||||||
|
printf "\n$MessageTitle\n"
|
||||||
|
printf "\n$MessageBody\n"
|
||||||
|
}
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||||
|
|
||||||
FromHost=$(hostname)
|
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
# Modify to fit your setup - set GotifyUrl and GotifyToken.
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
GotifyToken="Your Gotify token here"
|
GotifyToken="Your Gotify token here"
|
||||||
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
GotifyUrl="https://api.gotify/message?token=${GotifyToken}"
|
||||||
@@ -25,5 +16,30 @@ send_notification() {
|
|||||||
-F "message=${MessageBody}" \
|
-F "message=${MessageBody}" \
|
||||||
-F "priority=5" \
|
-F "priority=5" \
|
||||||
-X POST "${GotifyUrl}" 1> /dev/null
|
-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.
|
# Required receiving services must already be set up.
|
||||||
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
# Modify to fit your setup - set MatrixServer, Room_id and AccessToken
|
||||||
|
|
||||||
send_notification() {
|
FromHost=$(hostname)
|
||||||
[ -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"
|
|
||||||
|
|
||||||
|
trigger_notification() {
|
||||||
# Modify to fit your setup:
|
# Modify to fit your setup:
|
||||||
AccessToken="Your Matrix token here"
|
AccessToken="Your Matrix token here"
|
||||||
Room_id="Enter Room_id here"
|
Room_id="Enter Room_id here"
|
||||||
@@ -22,7 +14,30 @@ send_notification() {
|
|||||||
MsgBody="{\"msgtype\":\"m.text\",\"body\":\"$MessageBody\"}"
|
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
|
# 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"
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user