From 0a841fde3d1baedcc2b010c7a35118d0233ac2dc Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Mon, 30 Jan 2023 09:45:02 +0200 Subject: [PATCH] add move-to option --- files/process_motion_event.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/files/process_motion_event.sh b/files/process_motion_event.sh index 620dc36..c1ca841 100644 --- a/files/process_motion_event.sh +++ b/files/process_motion_event.sh @@ -6,6 +6,7 @@ test -e /var/lib/from_repos/scripts/shared_functions.sh && source /var/lib/from_ remove_picture=false signal_alert=false mail_alert=false +move_to='' data="\"date\": \"$(date +%s)\"" while [ $# -gt 0 ] @@ -163,6 +164,11 @@ do shift mail_alert=true ;; + "--move-to"|"-M") + shift + move_to="${1}" + shift + ;; *) ;; esac @@ -171,6 +177,9 @@ done if [ -n "${file}" ]; then file_uri=$(echo "${file}" | sed 's|/srv/expendable_data|https://ficheros.koti.site|g') data="${data}, \"file_uri\": \"${file_uri}\"" + if [ -n "${move_to}" ]; then + scp "${file}" "${move_to}/" && rm -rf "${file}" + fi fi data="{${data}}"