mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 10:12:06 +01:00
#588 fix error output debug.log
This commit is contained in:
parent
480a677290
commit
9f1a721690
@ -80,10 +80,10 @@ if [ "${state}" = "presync" ]; then
|
||||
# stopping the pre-sync
|
||||
echo ""
|
||||
# analyse if blockchain was detected broken by pre-sync
|
||||
blockchainBroken=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep -c "Please restart with -reindex or -reindex-chainstate to recover.")
|
||||
blockchainBroken=$(sudo tail /mnt/hdd/bitcoin/debug.log 2>/dev/null | grep -c "Please restart with -reindex or -reindex-chainstate to recover.")
|
||||
if [ ${blockchainBroken} -eq 1 ]; then
|
||||
# dismiss if its just a date thing
|
||||
futureBlock=$(sudo tail /mnt/hdd/bitcoin/debug.log | grep "Please restart with -reindex or -reindex-chainstate to recover." | grep -c "block database contains a block which appears to be from the future")
|
||||
futureBlock=$(sudo tail /mnt/hdd/bitcoin/debug.log 2>/dev/null | grep "Please restart with -reindex or -reindex-chainstate to recover." | grep -c "block database contains a block which appears to be from the future")
|
||||
if [ ${futureBlock} -gt 0 ]; then
|
||||
blockchainBroken=0
|
||||
echo "-> Ignore reindex - its just a future block"
|
||||
@ -172,10 +172,10 @@ waitUntilChainNetworkIsReady()
|
||||
if [ ${#clienterror} -gt 0 ]; then
|
||||
|
||||
# analyse LOGS for possible reindex
|
||||
reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
|
||||
reindex=$(sudo cat /mnt/hdd/${network}/debug.log 2>/dev/null | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
|
||||
if [ ${reindex} -gt 0 ]; then
|
||||
# dismiss if its just a date thing
|
||||
futureBlock=$(sudo tail /mnt/hdd/${network}/debug.log | grep "Please restart with -reindex or -reindex-chainstate to recover" | grep -c "block database contains a block which appears to be from the future")
|
||||
futureBlock=$(sudo tail /mnt/hdd/${network}/debug.log 2>/dev/null | grep "Please restart with -reindex or -reindex-chainstate to recover" | grep -c "block database contains a block which appears to be from the future")
|
||||
if [ ${futureBlock} -gt 0 ]; then
|
||||
blockchainBroken=0
|
||||
echo "-> Ignore reindex - its just a future block"
|
||||
|
@ -437,7 +437,7 @@ fi
|
||||
|
||||
###### Unlock Wallet (if needed)
|
||||
echo "*** Check Wallet Lock ***"
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
||||
if [ ${locked} -gt 0 ]; then
|
||||
echo "OK - Wallet is locked ... starting unlocking dialog"
|
||||
/home/admin/AAunlockLND.sh
|
||||
|
@ -22,7 +22,7 @@ while :
|
||||
do
|
||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} unlock
|
||||
sleep 4
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -c unlock)
|
||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
||||
if [ ${locked} -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
@ -274,7 +274,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
#presyncActive=$(systemctl status bitcoind | grep -c 'could not be found')
|
||||
echo "starting pre-sync in background" >> $logFile
|
||||
# make sure that debug file is clean, so just pre-sync gets analysed on stop
|
||||
sudo rm /mnt/hdd/bitcoin/debug.log
|
||||
sudo rm /mnt/hdd/bitcoin/debug.log 2>/dev/null
|
||||
# starting in background, because this scripts is part of systemd
|
||||
# so to change systemd needs to happen after delay in seperate process
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile
|
||||
|
@ -84,7 +84,7 @@ else
|
||||
#### HARD PROBLEMS
|
||||
|
||||
# LOW DISK SPACE
|
||||
lowDiskSpace=$(sudo tail -n 100 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "Error: Disk space is low!")
|
||||
lowDiskSpace=$(sudo tail -n 100 /mnt/hdd/${network}${pathAdd}/debug.log 2>/dev/null | grep -c "Error: Disk space is low!")
|
||||
if [ ${lowDiskSpace} -gt 0 ]; then
|
||||
bitcoinErrorShort="HDD DISK SPACE LOW"
|
||||
bitcoinErrorFull="HDD DISK SPACE LOW - check what data you can delete on HDD and restart"
|
||||
@ -94,7 +94,7 @@ else
|
||||
|
||||
# if still no error identified - search logs for generic error (after 4min uptime)
|
||||
if [ ${#bitcoinErrorShort} -eq 0 ] && [ ${uptime} -gt 240 ]; then
|
||||
bitcoinErrorFull=$(sudo tail -n 100 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "Error:" | tail -1 | tr -d "'")
|
||||
bitcoinErrorFull=$(sudo tail -n 100 /mnt/hdd/${network}${pathAdd}/debug.log 2>/dev/null | grep -c "Error:" | tail -1 | tr -d "'")
|
||||
if [ ${#bitcoinErrorFull} -gt 0 ]; then
|
||||
bitcoinErrorShort="Error found in Logs"
|
||||
fi
|
||||
@ -137,10 +137,10 @@ if [ ${lndRunning} -eq 1 ]; then
|
||||
|
||||
# find a the line number in logs of start of LND
|
||||
# just do this on error case to save on processing memory
|
||||
lndStartLineNumber=$(sudo cat /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log | grep -in "LTND: Active chain:" | tail -1 | cut -d ":" -f1)
|
||||
lndStartLineNumber=$(sudo cat /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -in "LTND: Active chain:" | tail -1 | cut -d ":" -f1)
|
||||
|
||||
# get logs of last LND start
|
||||
lndLogsAfterStart=$(sudo tail --lines=+${lndStartLineNumber} /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log)
|
||||
lndLogsAfterStart=$(sudo tail --lines=+${lndStartLineNumber} /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null)
|
||||
|
||||
# check RPC server ready (can take some time after wallet was unlocked)
|
||||
lndRPCReady=$(echo "${lndLogsAfterStart}" | grep -c "RPCS: RPC server listening on")
|
||||
|
@ -98,6 +98,6 @@ echo "*************************"
|
||||
sudo -u bitcoin ${network}-cli stop
|
||||
sleep 4
|
||||
# clean logs (to prevent a false reindex detection)
|
||||
sudo rm /mnt/hdd/${network}/debug.log
|
||||
sudo rm /mnt/hdd/${network}/debug.log 2>/dev/null
|
||||
# reboot
|
||||
sudo shutdown -r now
|
Loading…
Reference in New Issue
Block a user