mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 20:16:22 +02:00
Improve Copying Blockchain (#1609)
This commit is contained in:
committed by
rootzoll
parent
b125dc8b36
commit
b0d1cc5e89
@@ -167,7 +167,8 @@ if [ ${isMounted} -eq 1 ]; then
|
|||||||
echo "UNKOWN STATE - there is blockain data config, but blockchain service is not running"
|
echo "UNKOWN STATE - there is blockain data config, but blockchain service is not running"
|
||||||
echo "It seems that something went wrong during sync/download/copy of the blockchain."
|
echo "It seems that something went wrong during sync/download/copy of the blockchain."
|
||||||
echo "Or something with the config is not correct."
|
echo "Or something with the config is not correct."
|
||||||
echo "Sometimes a reboot helps --> sudo shutdown -r now"
|
echo "Sometimes a reboot helps - use command: restart"
|
||||||
|
echo "Or try to repair blockchain - use command: repair"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
|
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
|
||||||
|
@@ -45,7 +45,7 @@ if [ ${#sizeChainstate} -gt 0 ] && [ ${sizeChainstate} -gt 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${hasOldBlockchainData} -eq 1 ] && [ "$1" != "stop-after-script" ]; then
|
if [ ${hasOldBlockchainData} -eq 1 ] && [ "$1" != "stop-after-script" ]; then
|
||||||
dialog --title " Old Blockchain Data Found " --yesno "\nDo you want to delete the old/local blockchain data now?" 7 60
|
dialog --title " Old Blockchain Data Found " --yesno "\nDo you want to delete the existing blockchain data now?" 7 60
|
||||||
response=$?
|
response=$?
|
||||||
echo "response(${response})"
|
echo "response(${response})"
|
||||||
if [ "${response}" = "1" ]; then
|
if [ "${response}" = "1" ]; then
|
||||||
@@ -231,6 +231,15 @@ if [ ${quickCheckOK} -eq 0 ]; then
|
|||||||
|
|
||||||
echo "Wait 5 secs ..."
|
echo "Wait 5 secs ..."
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
dialog --title " INVALID TRANSFER - TRY AGAIN?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. Maybe transfere was interrupted and not completed.\n\nDo you want retry/proceed the copy process?" 8 70
|
||||||
|
response=$?
|
||||||
|
echo "response(${response})"
|
||||||
|
if [ "${response}" == "0" ]; then
|
||||||
|
/home/admin/50copyHDD.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data?" 8 60
|
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data?" 8 60
|
||||||
response=$?
|
response=$?
|
||||||
echo "response(${response})"
|
echo "response(${response})"
|
||||||
|
@@ -97,9 +97,21 @@ copyHost()
|
|||||||
echo "# Starting copy over LAN (around 4-6 hours) ..."
|
echo "# Starting copy over LAN (around 4-6 hours) ..."
|
||||||
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
|
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
|
||||||
cd /mnt/hdd/${network}
|
cd /mnt/hdd/${network}
|
||||||
|
|
||||||
|
# transfere beginning flag
|
||||||
|
date +%s > ./copy_begin.time
|
||||||
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' ./copy_begin.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
|
rm ./copy_begin.time
|
||||||
|
|
||||||
|
# transfere blockchain data
|
||||||
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' --info=progress2 ./chainstate ./blocks bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' --info=progress2 ./chainstate ./blocks bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
sed -i "s/^state=.*/state=/g" /home/admin/raspiblitz.info
|
sed -i "s/^state=.*/state=/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
# transfere end flag
|
||||||
|
date +%s > ./copy_end.time
|
||||||
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' ./copy_end.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
|
rm ./copy_end.time
|
||||||
|
|
||||||
echo "# start services again ..."
|
echo "# start services again ..."
|
||||||
sudo systemctl enable ${network}d
|
sudo systemctl enable ${network}d
|
||||||
sudo systemctl start ${network}d
|
sudo systemctl start ${network}d
|
||||||
|
@@ -40,6 +40,15 @@ do
|
|||||||
# gather the uptime seconds
|
# gather the uptime seconds
|
||||||
upSeconds=$(cat /proc/uptime | grep -o '^[0-9]\+')
|
upSeconds=$(cat /proc/uptime | grep -o '^[0-9]\+')
|
||||||
|
|
||||||
|
# prevent restart if COPY OVER LAN is running
|
||||||
|
# see: https://github.com/rootzoll/raspiblitz/issues/1179#issuecomment-646079467
|
||||||
|
source ${infoFile}
|
||||||
|
if [ "${state}" == "copysource" ]; then
|
||||||
|
echo "copysource mode: skipping background loop"
|
||||||
|
sleep 10
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# RECHECK DHCP-SERVER
|
# RECHECK DHCP-SERVER
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/160
|
# https://github.com/rootzoll/raspiblitz/issues/160
|
||||||
@@ -142,38 +151,27 @@ do
|
|||||||
recheckBlitzTUI=$(($counter % 30))
|
recheckBlitzTUI=$(($counter % 30))
|
||||||
if [ "${touchscreen}" == "1" ] && [ ${recheckBlitzTUI} -eq 1 ]; then
|
if [ "${touchscreen}" == "1" ] && [ ${recheckBlitzTUI} -eq 1 ]; then
|
||||||
echo "BlitzTUI Monitoring Check"
|
echo "BlitzTUI Monitoring Check"
|
||||||
|
if [ -d "/var/cache/raspiblitz" ]; then
|
||||||
# prevent restart if COPY OVER LAN is running
|
latestHeartBeatLine=$(sudo tail -n 300 /var/cache/raspiblitz/pi/blitz-tui.log | grep beat | tail -n 1)
|
||||||
# see: https://github.com/rootzoll/raspiblitz/issues/1179#issuecomment-646079467
|
|
||||||
source ${infoFile}
|
|
||||||
if [ "${state}" == "copysource" ]; then
|
|
||||||
echo "- skip BlitzTUI check while COPY over LAN is running"
|
|
||||||
else
|
else
|
||||||
|
latestHeartBeatLine=$(sudo tail -n 300 /home/pi/blitz-tui.log | grep beat | tail -n 1)
|
||||||
if [ -d "/var/cache/raspiblitz" ]; then
|
|
||||||
latestHeartBeatLine=$(sudo tail -n 300 /var/cache/raspiblitz/pi/blitz-tui.log | grep beat | tail -n 1)
|
|
||||||
else
|
|
||||||
latestHeartBeatLine=$(sudo tail -n 300 /home/pi/blitz-tui.log | grep beat | tail -n 1)
|
|
||||||
fi
|
|
||||||
if [ ${#blitzTUIHeartBeatLine} -gt 0 ]; then
|
|
||||||
#echo "blitzTUIHeartBeatLine(${blitzTUIHeartBeatLine})"
|
|
||||||
#echo "latestHeartBeatLine(${latestHeartBeatLine})"
|
|
||||||
if [ "${blitzTUIHeartBeatLine}" == "${latestHeartBeatLine}" ]; then
|
|
||||||
echo "FAIL - still no new heart beat .. restarting BlitzTUI"
|
|
||||||
blitzTUIRestarts=$(($blitzTUIRestarts +1))
|
|
||||||
if [ $(sudo cat /home/admin/raspiblitz.info | grep -c 'blitzTUIRestarts=') -eq 0 ]; then
|
|
||||||
echo "blitzTUIRestarts=0" >> /home/admin/raspiblitz.info
|
|
||||||
fi
|
|
||||||
sudo sed -i "s/^blitzTUIRestarts=.*/blitzTUIRestarts=${blitzTUIRestarts}/g" /home/admin/raspiblitz.info
|
|
||||||
sudo init 3 ; sleep 2 ; sudo init 5
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "blitzTUIHeartBeatLine is empty - skipping check"
|
|
||||||
fi
|
|
||||||
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
if [ ${#blitzTUIHeartBeatLine} -gt 0 ]; then
|
||||||
|
#echo "blitzTUIHeartBeatLine(${blitzTUIHeartBeatLine})"
|
||||||
|
#echo "latestHeartBeatLine(${latestHeartBeatLine})"
|
||||||
|
if [ "${blitzTUIHeartBeatLine}" == "${latestHeartBeatLine}" ]; then
|
||||||
|
echo "FAIL - still no new heart beat .. restarting BlitzTUI"
|
||||||
|
blitzTUIRestarts=$(($blitzTUIRestarts +1))
|
||||||
|
if [ $(sudo cat /home/admin/raspiblitz.info | grep -c 'blitzTUIRestarts=') -eq 0 ]; then
|
||||||
|
echo "blitzTUIRestarts=0" >> /home/admin/raspiblitz.info
|
||||||
|
fi
|
||||||
|
sudo sed -i "s/^blitzTUIRestarts=.*/blitzTUIRestarts=${blitzTUIRestarts}/g" /home/admin/raspiblitz.info
|
||||||
|
sudo init 3 ; sleep 2 ; sudo init 5
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "blitzTUIHeartBeatLine is empty - skipping check"
|
||||||
|
fi
|
||||||
|
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
Reference in New Issue
Block a user