mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-01 19:48:47 +02:00
Use correct birdsongs_dir
This commit is contained in:
@@ -29,13 +29,10 @@ log_green "Starting service: throttlerecording"
|
|||||||
########################################
|
########################################
|
||||||
# Define Directories, Files, and Constants
|
# Define Directories, Files, and Constants
|
||||||
########################################
|
########################################
|
||||||
INGEST_DIR="${RECS_DIR/StreamData:-$HOME/BirdSongs/StreamData}"
|
INGEST_DIR="$(readlink -f "$HOME/BirdSongs/StreamData")"
|
||||||
INGEST_DIR=$(readlink -f "$INGEST_DIR")
|
|
||||||
if [ /tmp/StreamData ]; then
|
|
||||||
INGEST_DIR="/tmp/StreamData"
|
|
||||||
fi
|
|
||||||
ANALYZING_NOW_FILE="$INGEST_DIR/analyzing_now.txt"
|
ANALYZING_NOW_FILE="$INGEST_DIR/analyzing_now.txt"
|
||||||
touch "$ANALYZING_NOW_FILE"
|
touch "$ANALYZING_NOW_FILE"
|
||||||
|
BIRDSONGS_DIR="$(readlink -f "$HOME/BirdSongs/Extracted/By_Date")"
|
||||||
|
|
||||||
# Ensure directories and set permissions
|
# Ensure directories and set permissions
|
||||||
mkdir -p "$INGEST_DIR" || { log_red "Failed to create directory: $INGEST_DIR"; exit 1; }
|
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"
|
local notification="<b>Issue:</b> $issue_message"
|
||||||
notification+="$stopped_service"
|
notification+="$stopped_service"
|
||||||
notification+="<br><b>System:</b> ${SITE_NAME:-$(hostname)}"
|
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>----Last log lines----"
|
||||||
notification+="<br> $(timeout 15 cat /proc/1/fd/1 | head -n 5)"
|
notification+="<br> $(timeout 15 cat /proc/1/fd/1 | head -n 5)"
|
||||||
notification+="<br>----------------------"
|
notification+="<br>----------------------"
|
||||||
@@ -114,7 +111,7 @@ apprisealert_recovery() {
|
|||||||
local TITLE="BirdNET-Pi System Recovered"
|
local TITLE="BirdNET-Pi System Recovered"
|
||||||
local notification="<b>All monitored services are back to normal.</b><br>"
|
local notification="<b>All monitored services are back to normal.</b><br>"
|
||||||
notification+="<b>System:</b> ${SITE_NAME:-$(hostname)}<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
|
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" \
|
"$HOME/BirdNET-Pi/birdnet/bin/apprise" -vv -t "$TITLE" -b "$notification" \
|
||||||
@@ -130,7 +127,7 @@ apprisealert_recovery() {
|
|||||||
|
|
||||||
check_disk_space() {
|
check_disk_space() {
|
||||||
local current_usage
|
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
|
if (( current_usage >= DISK_USAGE_THRESHOLD )); then
|
||||||
log_red "$(date) INFO: Disk usage is at ${current_usage}% (CRITICAL!)"
|
log_red "$(date) INFO: Disk usage is at ${current_usage}% (CRITICAL!)"
|
||||||
|
|||||||
Reference in New Issue
Block a user