From a2745fe5a0dc04b06df205551e4f4281a7e41207 Mon Sep 17 00:00:00 2001 From: dwrz Date: Thu, 22 Oct 2026 12:52:36 +0000 Subject: [PATCH] Fix notify script lock --- scripts/notify | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/notify b/scripts/notify index 6d66acb..f81d917 100755 --- a/scripts/notify +++ b/scripts/notify @@ -72,15 +72,12 @@ upload() { delete_outdated() { local filepath="$1" - acquire_lock - rm -f "$1" rm -f "${PROJECT}/motion/${name}.jpg" find "${HOME}/photo/" -mmin +5 -delete find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete find "${PROJECT}/motion/labels/" -mmin +5 -delete - release_lock } release_lock () { @@ -92,10 +89,13 @@ main() { local name name="$(basename "${filepath}" .jpg)" + acquire_lock + # If devices are present, don't notify. if (( "${#DEVICES[@]}" )); then if check_devices; then delete_outdated "${filepath}" "${name}" + release_lock exit 0 fi fi @@ -111,6 +111,7 @@ main() { upload "${name}" delete_outdated "${filepath}" "${name}" + release_lock } main "$@"