#5076 Adding SSD full Warning (#5077)

* #5076 remove datadir & correct log path
* #5076 add disk full warnings
This commit is contained in:
/rootzoll
2025-07-27 15:06:52 +02:00
committed by GitHub
parent a54c2f67da
commit 00f34e1c08
4 changed files with 61 additions and 4 deletions

View File

@@ -93,7 +93,7 @@ while :
source <(/home/admin/config.scripts/network.aliases.sh getvars) source <(/home/admin/config.scripts/network.aliases.sh getvars)
fi 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 # show status info during boot & setup & repair on LCD
if [ "${state}" == "" ]; then if [ "${state}" == "" ]; then

View File

@@ -246,6 +246,40 @@ do
fi fi
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 # SYSTEM LOG FILE SIZES
############################### ###############################

View File

@@ -45,15 +45,15 @@ if [ "$1" == "prestart" ]; then
case "${CHAIN}" in case "${CHAIN}" in
mainnet) mainnet)
bitcoinlog_entry="main.debuglogfile" bitcoinlog_entry="main.debuglogfile"
bitcoinlog_path="/mnt/hdd/bitcoin/debug.log" bitcoinlog_path="/mnt/hdd/app-data/bitcoin/debug.log"
;; ;;
testnet) testnet)
bitcoinlog_entry="test.debuglogfile" bitcoinlog_entry="test.debuglogfile"
bitcoinlog_path="/mnt/hdd/bitcoin/testnet3/debug.log" bitcoinlog_path="/mnt/hdd/app-data/bitcoin/testnet3/debug.log"
;; ;;
signet) signet)
bitcoinlog_entry="signet.debuglogfile" bitcoinlog_entry="signet.debuglogfile"
bitcoinlog_path="/mnt/hdd/bitcoin/signet/debug.log" bitcoinlog_path="/mnt/hdd/app-data/bitcoin/signet/debug.log"
;; ;;
esac 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.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 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 # make sure bitcoin debug file exists
echo "# make sure bitcoin debug file exists" echo "# make sure bitcoin debug file exists"
touch ${bitcoinlog_path} touch ${bitcoinlog_path}

View File

@@ -281,6 +281,22 @@ Preparing Provision
Please wait ... Please wait ...
" 6 24 " 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 elif [ "${eventID}" = "noIP-LAN" ] || [ "${eventID}" = "noIP-WIFI" ]; then
# this event is mostly for LCD/HDMI display # this event is mostly for LCD/HDMI display