From 00f34e1c0813b297b07371325bf5dea23797a23b Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Sun, 27 Jul 2025 15:06:52 +0200 Subject: [PATCH] #5076 Adding SSD full Warning (#5077) * #5076 remove datadir & correct log path * #5076 add disk full warnings --- home.admin/00infoLCD.sh | 2 +- home.admin/_background.sh | 34 ++++++++++++++++++++++ home.admin/config.scripts/bitcoin.check.sh | 13 +++++++-- home.admin/setup.scripts/eventInfoWait.sh | 16 ++++++++++ 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/home.admin/00infoLCD.sh b/home.admin/00infoLCD.sh index 855fac1b9..9c5770edf 100755 --- a/home.admin/00infoLCD.sh +++ b/home.admin/00infoLCD.sh @@ -93,7 +93,7 @@ while : source <(/home/admin/config.scripts/network.aliases.sh getvars) fi - if [ "${setupPhase}" != "done" ] || [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ] || [ "${state}" == "copytarget" ] || [ "${state}" == "copysource" ]; then + if [ "${setupPhase}" != "done" ] || [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ] || [ "${state}" == "copytarget" ] || [ "${state}" == "copysource" ] || [ "${state}" = "storageisfull" ] || [ "${state}" = "dataisfull" ]; then # show status info during boot & setup & repair on LCD if [ "${state}" == "" ]; then diff --git a/home.admin/_background.sh b/home.admin/_background.sh index a4c6523f0..b342b38ce 100755 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -246,6 +246,40 @@ do fi fi + ################################ + # CHECK FULL STORAGE + ################################ + + # check every 5min + recheckStorage=$(($counter % 300)) + if [ ${recheckStorage} -eq 1 ]; then + + echo "*** CHECK FULL STORAGE ***" + percent=$(df --output=pcent /mnt/disk_storage | tail -1 | tr -dc '0-9'); + if [ "${percent}" != "" ] && [ ${percent} -gt 98 ]; then + echo "WARN # STORAGE is ${percent} - sending warning" + /home/admin/_cache.sh set state "storageisfull" + /home/admin/_cache.sh set message "${percent}" + else + echo "OK - STORAGE is at ${percent}%" + fi + + echo "*** CHECK FULL DATA ***" + if mountpoint -q /mnt/disk_data; then + percent=$(df --output=pcent /mnt/disk_data | tail -1 | tr -dc '0-9'); + if [ "${percent}" != "" ] && [ ${percent} -gt 98 ]; then + echo "WARN # DATA is ${percent} - sending warning" + /home/admin/_cache.sh set state "dataisfull" + /home/admin/_cache.sh set message "${percent}" + else + echo "OK - DATA is at ${percent}%" + fi + else + echo "OK - /mnt/disk_data not mounted" + fi + + fi + ############################### # SYSTEM LOG FILE SIZES ############################### diff --git a/home.admin/config.scripts/bitcoin.check.sh b/home.admin/config.scripts/bitcoin.check.sh index ab7a102ae..d3d9511d9 100755 --- a/home.admin/config.scripts/bitcoin.check.sh +++ b/home.admin/config.scripts/bitcoin.check.sh @@ -45,15 +45,15 @@ if [ "$1" == "prestart" ]; then case "${CHAIN}" in mainnet) bitcoinlog_entry="main.debuglogfile" - bitcoinlog_path="/mnt/hdd/bitcoin/debug.log" + bitcoinlog_path="/mnt/hdd/app-data/bitcoin/debug.log" ;; testnet) bitcoinlog_entry="test.debuglogfile" - bitcoinlog_path="/mnt/hdd/bitcoin/testnet3/debug.log" + bitcoinlog_path="/mnt/hdd/app-data/bitcoin/testnet3/debug.log" ;; signet) bitcoinlog_entry="signet.debuglogfile" - bitcoinlog_path="/mnt/hdd/bitcoin/signet/debug.log" + bitcoinlog_path="/mnt/hdd/app-data/bitcoin/signet/debug.log" ;; esac @@ -78,6 +78,13 @@ if [ "$1" == "prestart" ]; then echo "main.walletdir=/mnt/hdd/app-data/bitcoin/wallets" >> /mnt/hdd/app-data/bitcoin/bitcoin.conf echo "main.wallet=wallet.dat" >> /mnt/hdd/app-data/bitcoin/bitcoin.conf + # remove any data directory entries - is already forced by parameter in bitcoind.service + echo "# remove any data directory entries" + sed -i '/^datadir=/d' /mnt/hdd/app-data/bitcoin/bitcoin.conf + sed -i '/^main.datadir=/d' /mnt/hdd/app-data/bitcoin/bitcoin.conf + sed -i '/^test.datadir=/d' /mnt/hdd/app-data/bitcoin/bitcoin.conf + sed -i '/^signet.datadir=/d' /mnt/hdd/app-data/bitcoin/bitcoin.conf + # make sure bitcoin debug file exists echo "# make sure bitcoin debug file exists" touch ${bitcoinlog_path} diff --git a/home.admin/setup.scripts/eventInfoWait.sh b/home.admin/setup.scripts/eventInfoWait.sh index ab13b016b..49b285710 100644 --- a/home.admin/setup.scripts/eventInfoWait.sh +++ b/home.admin/setup.scripts/eventInfoWait.sh @@ -281,6 +281,22 @@ Preparing Provision Please wait ... " 6 24 +elif [ "${eventID}" == "storageisfull" ]; then + + dialog --backtitle "${backtitle}" --cr-wrap --infobox " +Your storage SSD/NVME is full (${contentString}%). +Delete apps or migrate to a bigger drive. +ssh admin@${internet_localip} +" 7 50 + +elif [ "${eventID}" == "dataisfull" ]; then + + dialog --backtitle "${backtitle}" --cr-wrap --infobox " +Your data SSD/NVME is full (${contentString}%). +Delete apps or migrate to a bigger drive. +ssh admin@${internet_localip} +" 7 50 + elif [ "${eventID}" = "noIP-LAN" ] || [ "${eventID}" = "noIP-WIFI" ]; then # this event is mostly for LCD/HDMI display