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"
|
notify_prog="/usr/local/bin/sh.zio.notify"
|
||||||
|
|
||||||
if [[ $log_path == "" ]]; then
|
if [[ $log_path == "" ]]; then
|
||||||
|
if [[ -f "$message" ]]; then
|
||||||
log_path="$message"
|
log_path="$message"
|
||||||
message=""
|
message=""
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -f "$notify_prog" ]]; then
|
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
|
else
|
||||||
"$notify_prog" \
|
notify_command="$notify_prog"
|
||||||
--file "$log_path" \
|
[[ -n "$log_path" ]] && notify_command+=" --file \"$log_path\""
|
||||||
--level "$level" \
|
[[ -n "$message" ]] && notify_command+=" --message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`'"
|
||||||
--message '\\`\\`\\`\\n'"${message//$'\n'/'\\n'}"'\\n\\`\\`\\`' \
|
notify_command+=" --level $level"
|
||||||
--title "$title"
|
notify_command+=" --title \"$title\""
|
||||||
|
|
||||||
|
eval $notify_command
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue