From 61279988beddd2ee708117117ae96c350d217725 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Wed, 1 Dec 2021 10:29:06 -0500 Subject: [PATCH] fixing Disk Full behavior -- invokes `stop_core_services.sh` --- scripts/disk_check.sh | 8 ++++++++ templates/cleanup.cron | 2 ++ 2 files changed, 10 insertions(+) create mode 100755 scripts/disk_check.sh diff --git a/scripts/disk_check.sh b/scripts/disk_check.sh new file mode 100755 index 0000000..4c955af --- /dev/null +++ b/scripts/disk_check.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +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 +fi diff --git a/templates/cleanup.cron b/templates/cleanup.cron index 136cd01..afee84e 100644 --- a/templates/cleanup.cron +++ b/templates/cleanup.cron @@ -1,4 +1,6 @@ #birdnet +*/5 * * * * /usr/local/bin/disk_check.sh &> /dev/null +#birdnet */3 * * * * /usr/local/bin/cleanup.sh &> /dev/null #birdnet @reboot /usr/local/bin/cleanup.sh &> /dev/null