mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-02 03:10:31 +02:00
Update 30-monitoring.sh
This commit is contained in:
@@ -30,9 +30,7 @@ if [ -z "${RTSP_STREAM}" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /tmp/StreamData ]; then
|
ingest_dir="$(readlink -f "$ingest_dir")" || true
|
||||||
RECS_DIR=/tmp
|
|
||||||
fi
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
sleep 61
|
sleep 61
|
||||||
@@ -41,22 +39,22 @@ while true; do
|
|||||||
############################
|
############################
|
||||||
|
|
||||||
if (( counter <= 0 )); then
|
if (( counter <= 0 )); then
|
||||||
latest=$(cat "$RECS_DIR"/StreamData/analyzing_now.txt)
|
latest=$(cat "$ingest_dir/analyzing_now.txt)
|
||||||
if [[ "$latest" == "$analyzing_now" ]]; then
|
if [[ "$latest" == "$analyzing_now" ]]; then
|
||||||
echo "$(date) WARNING no change in analyzing_now for 10 iterations, restarting services"
|
echo "$(date) WARNING no change in analyzing_now for 10 iterations, restarting services"
|
||||||
"$HOME"/BirdNET-Pi/scripts/restart_services.sh
|
"$HOME"/BirdNET-Pi/scripts/restart_services.sh
|
||||||
fi
|
fi
|
||||||
counter=10
|
counter=10
|
||||||
analyzing_now=$(cat "$HOME"/BirdSongs/StreamData/analyzing_now.txt)
|
analyzing_now=$(cat "$ingest_dir/analyzing_now.txt)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pause recorder to catch-up
|
# Pause recorder to catch-up
|
||||||
############################
|
############################
|
||||||
|
|
||||||
wavs="$(find "${ingest_dir}" -maxdepth 1 -name '*.wav' | wc -l)"
|
wavs="$(find "$ingest_dir" -maxdepth 1 -name '*.wav' | wc -l)"
|
||||||
state="$(systemctl is-active "$srv")"
|
state="$(systemctl is-active "$srv")"
|
||||||
|
|
||||||
bashio::log.green "$(date) INFO ${wavs} wav files waiting in $(readlink -f "$ingest_dir"), $srv state is $state"
|
bashio::log.green "$(date) INFO ${wavs} wav files waiting in $ingest_dir, $srv state is $state"
|
||||||
|
|
||||||
if (( wavs > 100 )) && [[ "$state" == "active" ]]; then
|
if (( wavs > 100 )) && [[ "$state" == "active" ]]; then
|
||||||
sudo systemctl stop "$srv"
|
sudo systemctl stop "$srv"
|
||||||
|
|||||||
Reference in New Issue
Block a user