mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-15 07:48:14 +01:00
finalizing new notification structure
This commit is contained in:
parent
71967277aa
commit
111cb955b1
10 changed files with 194 additions and 113 deletions
|
|
@ -49,26 +49,26 @@ __EOF
|
|||
}
|
||||
|
||||
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 email notification\n"
|
||||
printf "\nSending email notification.\n"
|
||||
|
||||
MessageTitle="Updates available on"
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||
MessageTitle="Updates available on"
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||
|
||||
trigger_notification
|
||||
trigger_notification
|
||||
}
|
||||
|
||||
### Remove or comment out the following function
|
||||
### to not send notifications when dockcheck itself has updates.
|
||||
dockcheck_notification() {
|
||||
printf "\nSending email dockcheck notification\n"
|
||||
printf "\nSending email dockcheck notification.\n"
|
||||
|
||||
MessageTitle="New version of dockcheck available on"
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||
MessageTitle="New version of dockcheck available on"
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "Installed version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||
|
||||
trigger_notification
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ send_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
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,33 +6,31 @@
|
|||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
|
||||
printf "\n$MessageTitle\n"
|
||||
printf "\n$MessageBody\n"
|
||||
# Modify to fit your setup:
|
||||
printf "\n$MessageTitle\n"
|
||||
printf "\n$MessageBody\n"
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
|
||||
trigger_notification
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\n%bGeneric notification addon:%b" "$c_green" "$c_reset"
|
||||
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
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ send_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"
|
||||
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
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ send_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
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,39 @@
|
|||
# Setup app and subscription at https://ntfy.sh
|
||||
# Use your unique Topic Name in the URL below.
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
printf "\nSending ntfy.sh notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
NtfyUrl="ntfy.sh/YourUniqueTopicName"
|
||||
|
||||
curl -sS -o /dev/null --show-error --fail \
|
||||
-H "Title: $MessageTitle" \
|
||||
-d "$MessageBody" \
|
||||
$NtfyUrl
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
NtfyUrl="ntfy.sh/YourUniqueTopicName"
|
||||
|
||||
curl -sS -o /dev/null --show-error --fail \
|
||||
-H "Title: $MessageTitle" \
|
||||
-d "$MessageBody" \
|
||||
$NtfyUrl
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
printf "\nSending ntfy.sh notification\n"
|
||||
|
||||
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 ntfy.sh 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,23 +5,39 @@
|
|||
# Requires jq installed and in PATH.
|
||||
# Modify to fit your setup - set Url and Token.
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushbullet notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
|
||||
# Modify to fit your setup:
|
||||
PushUrl="https://api.pushbullet.com/v2/pushes"
|
||||
PushToken="Your Pushbullet token here"
|
||||
|
||||
# Requires jq to process json data
|
||||
jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @-
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
PushUrl="https://api.pushbullet.com/v2/pushes"
|
||||
PushToken="Your Pushbullet token here"
|
||||
|
||||
# Requires jq to process json data
|
||||
jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @-
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushbullet notification\n"
|
||||
|
||||
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 pushbullet 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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,18 +5,9 @@
|
|||
# Requires jq installed and in PATH.
|
||||
# Modify to fit your setup - set Url and Token.
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushover notification\n"
|
||||
|
||||
MessageTitle="$FromHost - updates available."
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n$UpdToString"
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
# Modify to fit your setup:
|
||||
PushoverUrl="https://api.pushover.net/1/messages.json"
|
||||
PushoverUserKey="Your Pushover User Key Here"
|
||||
|
|
@ -30,3 +21,29 @@ send_notification() {
|
|||
-F "message=$MessageBody" \
|
||||
$PushoverUrl
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending pushover notification\n"
|
||||
|
||||
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"
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,25 +16,19 @@ else
|
|||
echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1
|
||||
fi
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
trigger_notification() {
|
||||
# User variables:
|
||||
SendMailFrom="me@mydomain.tld"
|
||||
SendMailTo="me@mydomain.tld"
|
||||
SubjectTag="dockcheck"
|
||||
|
||||
printf "\nSending email notification.\n"
|
||||
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||
|
||||
$MailPkg $SendMailTo << __EOF
|
||||
From: "$FromHost" <$SendMailFrom>
|
||||
date:$(date -R)
|
||||
To: <$SendMailTo>
|
||||
Subject: [$SubjectTag] Updates available on $FromHost
|
||||
Subject: [$SubjectTag] $MessageTitle $FromHost
|
||||
Content-Type: text/plain; charset=UTF-8; format=flowed
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
|
|
@ -42,3 +36,28 @@ $MessageBody
|
|||
|
||||
__EOF
|
||||
}
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
printf "\nSending email notification.\n"
|
||||
|
||||
MessageTitle="Updates available on"
|
||||
# Setting the MessageBody variable here.
|
||||
printf -v MessageBody "🐋 Containers on $FromHost with updates available:\n\n$UpdToString"
|
||||
|
||||
trigger_notification
|
||||
}
|
||||
|
||||
### Remove or comment out the following function
|
||||
### to not send notifications when dockcheck itself has updates.
|
||||
dockcheck_notification() {
|
||||
printf "\nSending email dockcheck notification.\n"
|
||||
|
||||
MessageTitle="New version of dockcheck available on"
|
||||
# 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 TelegramChatId and TelegramToken.
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
FromHost=$(hostname)
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending Telegram 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:
|
||||
TelegramToken="Your Telegram token here"
|
||||
TelegramChatId="Your Telegram ChatId here"
|
||||
|
|
@ -24,4 +16,27 @@ send_notification() {
|
|||
|
||||
curl -sS -o /dev/null --fail -X POST "$TelegramUrl/sendMessage" -H 'Content-Type: application/json' -d "$TelegramData"
|
||||
|
||||
send_notification() {
|
||||
[ -s "$ScriptWorkDir"/urls.list ] && releasenotes || Updates=("$@")
|
||||
UpdToString=$( printf '%s\\n' "${Updates[@]}" )
|
||||
|
||||
# platform specific notification code would go here
|
||||
printf "\nSending Telegram 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 "$FromHost - New version of dockcheck available.\n\nInstalled version: $1 \nLatest version: $2 \n\nChangenotes: $3"
|
||||
|
||||
trigger_notification
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue