diff --git a/notify_templates/notify_DSM.sh b/notify_templates/notify_DSM.sh index 2affe30..1c74c11 100644 --- a/notify_templates/notify_DSM.sh +++ b/notify_templates/notify_DSM.sh @@ -9,17 +9,17 @@ MSMTP=$(which msmtp) SSMTP=$(which ssmtp) -if [ -n $MSMPT ] ; then - MAIL=$MSMTP -elif [ -n $SSMTP ] && [ -z $MAIL ] ; then - MAIL=$SSMTP +if [ -n "$MSMPT" ] ; then + MailPkg=$MSMTP +elif [ -n "$SSMTP" ] ; then + MailPkg=$SSMTP else echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1 fi send_notification() { Updates=("$@") -UpdToString=$( printf "%s\n" "${Updates[@]}" ) +[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) CfgFile="/usr/syno/etc/synosmtp.conf" @@ -36,7 +36,7 @@ SenderMail=${SenderMail:-$(grep 'eventmail1' $CfgFile | sed -n 's/.*"\([^"]*\)". printf "\nSending email notification.\n" -$MAIL $SendMailTo << __EOF +$MailPkg $SendMailTo << __EOF From: "$SenderName" <$SenderMail> date:$(date -R) To: <$SendMailTo> diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index 9080cd8..b3c0219 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -6,7 +6,7 @@ send_notification() { Updates=("$@") -UpdToString=$( printf "%s\n" "${Updates[@]}" ) +[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) printf "\nSending Apprise notification\n" diff --git a/notify_templates/notify_gotify.sh b/notify_templates/notify_gotify.sh index 832b387..5590ea2 100644 --- a/notify_templates/notify_gotify.sh +++ b/notify_templates/notify_gotify.sh @@ -6,7 +6,7 @@ send_notification() { Updates=("$@") - UpdToString=$( printf "%s\n" "${Updates[@]}" ) + [ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # platform specific notification code would go here diff --git a/notify_templates/notify_matrix.sh b/notify_templates/notify_matrix.sh index 998592a..b9af93a 100644 --- a/notify_templates/notify_matrix.sh +++ b/notify_templates/notify_matrix.sh @@ -6,7 +6,7 @@ send_notification() { Updates=("$@") - UpdToString=$( printf "%s\n" "${Updates[@]}" ) + [ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # platform specific notification code would go here diff --git a/notify_templates/notify_ntfy-sh.sh b/notify_templates/notify_ntfy-sh.sh index a388b02..dc9ded7 100644 --- a/notify_templates/notify_ntfy-sh.sh +++ b/notify_templates/notify_ntfy-sh.sh @@ -6,7 +6,7 @@ send_notification() { Updates=("$@") -UpdToString=$( printf "%s\n" "${Updates[@]}" ) +[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) printf "\nSending ntfy.sh notification\n" diff --git a/notify_templates/notify_pushbullet.sh b/notify_templates/notify_pushbullet.sh index 9019017..c422ad8 100644 --- a/notify_templates/notify_pushbullet.sh +++ b/notify_templates/notify_pushbullet.sh @@ -7,7 +7,7 @@ send_notification() { Updates=("$@") -UpdToString=$( printf "%s\n" "${Updates[@]}" ) +[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # platform specific notification code would go here diff --git a/notify_templates/notify_pushover.sh b/notify_templates/notify_pushover.sh index 805e7ec..85182b8 100644 --- a/notify_templates/notify_pushover.sh +++ b/notify_templates/notify_pushover.sh @@ -7,7 +7,7 @@ send_notification() { Updates=("$@") - UpdToString=$( printf "%s\n" "${Updates[@]}" ) + [ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # platform specific notification code would go here diff --git a/notify_templates/notify_smtp.sh b/notify_templates/notify_smtp.sh index 9c81aa9..8ae8bec 100644 --- a/notify_templates/notify_smtp.sh +++ b/notify_templates/notify_smtp.sh @@ -8,17 +8,17 @@ MSMTP=$(which msmtp) SSMTP=$(which ssmtp) -if [ -n $MSMPT ] ; then - MAIL=$MSMTP -elif [ -n $SSMTP ] && [ -z $MAIL ] ; then - MAIL=$SSMTP +if [ -n "$MSMPT" ] ; then + MailPkg=$MSMTP +elif [ -n "$SSMTP" ] ; then + MailPkg=$SSMTP else echo "No msmtp or ssmtp binary found in PATH: $PATH" ; exit 1 fi send_notification() { Updates=("$@") -UpdToString=$( printf "%s\n" "${Updates[@]}" ) +[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # User variables: @@ -28,7 +28,7 @@ SubjectTag="dockcheck" printf "\nSending email notification.\n" -$MAIL $SendMailTo << __EOF +$MailPkg $SendMailTo << __EOF From: "$FromHost" <$SendMailFrom> date:$(date -R) To: <$SendMailTo> diff --git a/notify_templates/notify_telegram.sh b/notify_templates/notify_telegram.sh index 45584e6..6183ccb 100644 --- a/notify_templates/notify_telegram.sh +++ b/notify_templates/notify_telegram.sh @@ -6,7 +6,7 @@ send_notification() { Updates=("$@") - UpdToString=$( printf "%s\n" "${Updates[@]}" ) + [ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" ) FromHost=$(hostname) # platform specific notification code would go here