Skip to content

A live bird collage card for your Home Assistant dashboard.

updated the disk-check utility to have options for removing old data or stopping core services

mcguirepr89d570324ac7a7
diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh
index 5c06af31..55c88acf 100755
--- a/Birders_Guide_Installer.sh
+++ b/Birders_Guide_Installer.sh
@@ -263,6 +263,12 @@ SENSITIVITY=1.25
CHANNELS=2
+## FULL_DISK can be set to configure how the system reacts to a full disk
+## 0 = Remove the oldest day's worth of recordings
+## 1 = Keep all data and 'stop_core_services.sh'
+
+FULL_DISK=0
+
## VENV is the virtual environment where the the BirdNET python build is found,
## i.e, VENV is the virtual environment miniforge built for BirdNET.
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index 751ff8bf..38b53ad6 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -175,6 +175,12 @@ SENSITIVITY=1.25
CHANNELS=2
+## FULL_DISK can be set to configure how the system reacts to a full disk
+## 0 = Remove the oldest day's worth of recordings
+## 1 = Keep all data and `stop_core_services.sh`
+
+FULL_DISK=0
+
## VENV is the virtual environment where the the BirdNET python build is found,
## i.e, VENV is the virtual environment miniforge built for BirdNET.
@@ -196,3 +202,6 @@ BIRDNET_USER=pi
## These are just for debugging
LAST_RUN=
THIS_RUN=
+## These are just for debugging
+LAST_RUN=
+THIS_RUN=
diff --git a/scripts/disk_check.sh b/scripts/disk_check.sh
index 4c955afb..0d77e84f 100755
--- a/scripts/disk_check.sh
+++ b/scripts/disk_check.sh
@@ -2,7 +2,14 @@
set -x
used="$(df -h / | tail -n1 | awk '{print $5}')"
-if [ "${used//%}" -gt 95 ]; then
- echo "Stopping Core Services"
- /usr/local/bin/stop_core_services.sh
+if [ "${used//%}" -ge 95 ]; then
+ source /etc/birdnet/birdnet.conf
+
+ case $FULL_DISK in
+ 0) echo "Removing oldest data"
+ rm -drfv "$(find ${EXTRACTED}/By_Date/* -maxdepth 1 -type d -prune \
+ | sort -r | tail -n1)";;
+ *) echo "Stopping Core Services"
+ /usr/local/bin/stop_core_services.sh;;
+ esac
fi
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index 884c7f28..26b407f2 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -342,6 +342,12 @@ SENSITIVITY=${SENSITIVITY}
CHANNELS=${CHANNELS}
+## FULL_DISK can be set to configure how the system reacts to a full disk
+## 0 = Remove the oldest day's worth of recordings
+## 1 = Keep all data and 'stop_core_services.sh'
+
+FULL_DISK=0
+
## VENV is the virtual environment where the the BirdNET python build is found,
## i.e, VENV is the virtual environment miniforge built for BirdNET.