Add parameter for signal and mail alerts
This commit is contained in:
parent
d145f87140
commit
6f9d633590
1 changed files with 14 additions and 2 deletions
|
@ -4,6 +4,8 @@
|
||||||
test -e /var/lib/from_repos/scripts/shared_functions.sh && source /var/lib/from_repos/scripts/shared_functions.sh
|
test -e /var/lib/from_repos/scripts/shared_functions.sh && source /var/lib/from_repos/scripts/shared_functions.sh
|
||||||
|
|
||||||
remove_picture=false
|
remove_picture=false
|
||||||
|
signal_alert=false
|
||||||
|
mail_alert=false
|
||||||
|
|
||||||
data="\"date\": \"$(date +%s)\""
|
data="\"date\": \"$(date +%s)\""
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
|
@ -153,6 +155,14 @@ do
|
||||||
shift
|
shift
|
||||||
remove_picture=true
|
remove_picture=true
|
||||||
;;
|
;;
|
||||||
|
"--signal-alert"|"-S")
|
||||||
|
shift
|
||||||
|
signal_alert=true
|
||||||
|
;;
|
||||||
|
"--mail-alert"|"-m")
|
||||||
|
shift
|
||||||
|
mail_alert=true
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -164,11 +174,13 @@ if [ -n "${file}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
data="{${data}}"
|
data="{${data}}"
|
||||||
if [ "${event_type}" == "on_movie_end" ]; then
|
if [ "${signal_alert}" ]; then
|
||||||
message "Sending to Signal destination '${signal_destination}'..."
|
message "Sending to Signal destination '${signal_destination}'..."
|
||||||
/var/lib/from_repos/signal_scripts/send_msg.sh --destination "${signal_destination}" \
|
/var/lib/from_repos/signal_scripts/send_msg.sh --destination "${signal_destination}" \
|
||||||
--message "Clip termino en camara '${camera_name}' (${motion_host}). Evento: #${event}. File: ${file_uri}"
|
--message "Clip termino en camara '${camera_name}' (${motion_host}). Evento: #${event}. File: ${file_uri}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${mail_alert}" ]; then
|
||||||
message "Sending email to '${email_destination}'..."
|
message "Sending email to '${email_destination}'..."
|
||||||
echo "${data}" | jq '.' | mail -s "Motion event '${event_type}' on host '${motion_host}' camera '${camera_name}'" "${email_destination}"
|
echo "${data}" | jq '.' | mail -s "Motion event '${event_type}' on host '${motion_host}' camera '${camera_name}'" "${email_destination}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue