From ce017a9baea92169f44a9ed5d277dd777ada9901 Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Wed, 6 Jul 2022 08:11:17 -0400 Subject: [PATCH] cleanup.sh now checks for a backlog of raw audio --- scripts/cleanup.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 69cb22d..72afe4c 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash source /etc/birdnet/birdnet.conf +set -x cd "${PROCESSED}" || exit 1 empties=($(find ${PROCESSED} -size 57c)) @@ -11,3 +12,7 @@ done if [[ "$(find ${PROCESSED} | wc -l)" -ge 100 ]];then ls -1t . | tail -n +100 | xargs -r rm -vv fi + +accumulated_files=$(find $RECS_DIR -path $PROCESSED -prune -o -type f -print | wc -l) +[ $accumulated_files -ge 10 ] && stop_core_services.sh +echo "$(date "+%b %e %I:%M:%S") Stopped Core Services -- Check raw recordings in $RECS_DIR" | sudo tee -a /var/log/syslog