Fix notify script lock

This commit is contained in:
dwrz
2026-10-22 12:52:36 +00:00
parent 974f604efd
commit a2745fe5a0
+4 -3
View File
@@ -72,15 +72,12 @@ upload() {
delete_outdated() { delete_outdated() {
local filepath="$1" local filepath="$1"
acquire_lock
rm -f "$1" rm -f "$1"
rm -f "${PROJECT}/motion/${name}.jpg" rm -f "${PROJECT}/motion/${name}.jpg"
find "${HOME}/photo/" -mmin +5 -delete find "${HOME}/photo/" -mmin +5 -delete
find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete find "${PROJECT}/motion/" -iname "*.jpg" -mmin +5 -delete
find "${PROJECT}/motion/labels/" -mmin +5 -delete find "${PROJECT}/motion/labels/" -mmin +5 -delete
release_lock
} }
release_lock () { release_lock () {
@@ -92,10 +89,13 @@ main() {
local name local name
name="$(basename "${filepath}" .jpg)" name="$(basename "${filepath}" .jpg)"
acquire_lock
# If devices are present, don't notify. # If devices are present, don't notify.
if (( "${#DEVICES[@]}" )); then if (( "${#DEVICES[@]}" )); then
if check_devices; then if check_devices; then
delete_outdated "${filepath}" "${name}" delete_outdated "${filepath}" "${name}"
release_lock
exit 0 exit 0
fi fi
fi fi
@@ -111,6 +111,7 @@ main() {
upload "${name}" upload "${name}"
delete_outdated "${filepath}" "${name}" delete_outdated "${filepath}" "${name}"
release_lock
} }
main "$@" main "$@"