sh.zio.backup: handle empty message in notification
parent
41c730e999
commit
a06ebcb217
|
@ -157,18 +157,22 @@ function trigger_notify() {
|
|||
notify_prog="/usr/local/bin/sh.zio.notify"
|
||||
|
||||
if [[ $log_path == "" ]]; then
|
||||
log_path="$message"
|
||||
message=""
|
||||
if [[ -f "$message" ]]; then
|
||||
log_path="$message"
|
||||
message=""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "$notify_prog" ]]; then
|
||||
say warning "'$notify_prog' not found. Not sending notification"
|
||||
say warning "'$notify_prog' does not exist. Not sending notification"
|
||||
else
|
||||
"$notify_prog" \
|
||||
--file "$log_path" \
|
||||
--level "$level" \
|
||||
--message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`' \
|
||||
--title "$title"
|
||||
notify_command="$notify_prog"
|
||||
[[ -n "$log_path" ]] && notify_command+=" --file \"$log_path\""
|
||||
[[ -n "$message" ]] && notify_command+=" --message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`'"
|
||||
notify_command+=" --level $level"
|
||||
notify_command+=" --title \"$title\""
|
||||
|
||||
eval $notify_command
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue