diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh index 5c06af3..55c88ac 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 751ff8b..38b53ad 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 4c955af..0d77e84 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 884c7f2..26b407f 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.