Use correct birdsongs_dir

This commit is contained in:
Alexandre
2025-02-05 15:28:11 +01:00
committed by GitHub
parent 1024cfb15d
commit 05acdc27a2

View File

@@ -29,13 +29,10 @@ log_green "Starting service: throttlerecording"
########################################
# Define Directories, Files, and Constants
########################################
INGEST_DIR="${RECS_DIR/StreamData:-$HOME/BirdSongs/StreamData}"
INGEST_DIR=$(readlink -f "$INGEST_DIR")
if [ /tmp/StreamData ]; then
INGEST_DIR="/tmp/StreamData"
fi
INGEST_DIR="$(readlink -f "$HOME/BirdSongs/StreamData")"
ANALYZING_NOW_FILE="$INGEST_DIR/analyzing_now.txt"
touch "$ANALYZING_NOW_FILE"
BIRDSONGS_DIR="$(readlink -f "$HOME/BirdSongs/Extracted/By_Date")"
# Ensure directories and set permissions
mkdir -p "$INGEST_DIR" || { log_red "Failed to create directory: $INGEST_DIR"; exit 1; }
@@ -89,7 +86,7 @@ apprisealert() {
local notification="<b>Issue:</b> $issue_message"
notification+="$stopped_service"
notification+="<br><b>System:</b> ${SITE_NAME:-$(hostname)}"
notification+="<br>Available disk space: $(df -h "$HOME/BirdSongs" | awk 'NR==2 {print $4}')"
notification+="<br>Available disk space: $(df -h "$BIRDSONGS_DIR" | awk 'NR==2 {print $4}')"
notification+="<br>----Last log lines----"
notification+="<br> $(timeout 15 cat /proc/1/fd/1 | head -n 5)"
notification+="<br>----------------------"
@@ -114,7 +111,7 @@ apprisealert_recovery() {
local TITLE="BirdNET-Pi System Recovered"
local notification="<b>All monitored services are back to normal.</b><br>"
notification+="<b>System:</b> ${SITE_NAME:-$(hostname)}<br>"
notification+="Available disk space: $(df -h "$HOME/BirdSongs" | awk 'NR==2 {print $4}')"
notification+="Available disk space: $(df -h "$BIRDSONGS_DIR" | awk 'NR==2 {print $4}')"
if [[ -f "$HOME/BirdNET-Pi/birdnet/bin/apprise" && -s "$HOME/BirdNET-Pi/apprise.txt" ]]; then
"$HOME/BirdNET-Pi/birdnet/bin/apprise" -vv -t "$TITLE" -b "$notification" \
@@ -130,7 +127,7 @@ apprisealert_recovery() {
check_disk_space() {
local current_usage
current_usage=$(df -h "$HOME/BirdSongs" | awk 'NR==2 {print $5}' | sed 's/%//')
current_usage=$(df -h "$BIRDSONGS_DIR" | awk 'NR==2 {print $5}' | sed 's/%//')
if (( current_usage >= DISK_USAGE_THRESHOLD )); then
log_red "$(date) INFO: Disk usage is at ${current_usage}% (CRITICAL!)"