Browse Source

#561 deleting lnd & bitcoin logs on every boot

master
Christian Rotzoll 6 years ago
parent
commit
6e6fa0f6c2
  1. 26
      home.admin/00raspiblitz.sh
  2. 10
      home.admin/_bootstrap.sh

26
home.admin/00raspiblitz.sh

@ -80,12 +80,13 @@ if [ "${state}" = "presync" ]; then
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.")
# 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")
if [ ${futureBlock} -gt 0 ]; then
blockchainBroken=0
echo "-> Ignore reindex - its just a future block, but delete logs to avoid future mismatches"
sudo rm /mnt/hdd/bitcoin/debug.log
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")
if [ ${futureBlock} -gt 0 ]; then
blockchainBroken=0
echo "-> Ignore reindex - its just a future block"
fi
fi
if [ ${blockchainBroken} -eq 1 ]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@ -171,12 +172,13 @@ waitUntilChainNetworkIsReady()
# analyse LOGS for possible reindex
reindex=$(sudo cat /mnt/hdd/${network}/debug.log | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
# 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")
if [ ${futureBlock} -gt 0 ]; then
blockchainBroken=0
echo "-> Ignore reindex - its just a future block, but delete logs to avoid future mismatches"
sudo rm /mnt/hdd/${network}/debug.log
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")
if [ ${futureBlock} -gt 0 ]; then
blockchainBroken=0
echo "-> Ignore reindex - its just a future block"
fi
fi
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."

10
home.admin/_bootstrap.sh

@ -458,6 +458,16 @@ if [ ${loaded} -gt 0 ]; then
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
fi
################################
# DELETE LOG FILES
################################
# LND and Blockchain Errors will be still in systemd journals
# /mnt/hdd/bitcoin/debug.log
sudo rm /mnt/hdd/${network}/debug.log 2>/dev/null
# /mnt/hdd/lnd/logs/bitcoin/mainnet/lnd.log
sudo rm /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null
################################
# STRESSTEST HARDWARE
################################

Loading…
Cancel
Save