Files
AvianVisitors/scripts/disk_check.sh
T
mcguirepr89 c4ee9bf721 fixed typos
2022-01-26 07:47:35 -05:00

25 lines
624 B
Bash
Executable File

#!/usr/bin/env bash
set -x
used="$(df -h / | tail -n1 | awk '{print $5}')"
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
sleep 1
if [ "${used//%}" -ge 95 ]; then
case $FULL_DISK in
0) echo "Removing more data"
rm -rfv ${PROCESSED}/*;;
*) echo "Stopping Core Services"
/usr/local/bin/stop_core_services.sh;;
esac
fi