attach files
This commit is contained in:
parent
bb24590a17
commit
fbb724b12e
1 changed files with 12 additions and 3 deletions
|
@ -230,12 +230,21 @@ if [ "${mail_alert}" == "true" ]; then
|
|||
fi
|
||||
|
||||
if [ -n "${ntfy_server}" ]; then
|
||||
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\"}" # , \"email\": \"${email_destination}\" }"
|
||||
if [ -n "${file}" ]; then
|
||||
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\", \"filename\": \"${file}\" }"
|
||||
else
|
||||
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\"}"
|
||||
fi
|
||||
ntfy_password="$(cat "${ntfy_password_file}")"
|
||||
message "Sending event to ntfy server '${ntfy_server}/motion_detection' ..."
|
||||
message "Data: ${ntfy_data}"
|
||||
curl -s "${ntfy_server}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
|
||||
return_code=$?
|
||||
if [ -n "${file}" ]; then
|
||||
curl -s "${ntfy_server}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
|
||||
return_code=$?
|
||||
else
|
||||
curl -s "${ntfy_server}" -T "${file}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
|
||||
return_code=$?
|
||||
fi
|
||||
if [ $return_code != 0 ]; then
|
||||
message "Error ${return_code} publishing in ntfy server '${ntfy}'"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue