mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
wait for blockchain service to start
This commit is contained in:
parent
c49071d0c3
commit
f90884f4ac
3 changed files with 43 additions and 29 deletions
|
@ -158,7 +158,7 @@ if [ ${isMounted} -eq 1 ]; then
|
|||
|
||||
# are there any signs of blockchain data and activity
|
||||
# setup running with admin user, but has no permission to read /mnt/hdd/bitcoin/blocks/, sudo needed
|
||||
blockchainDataExists=$(sudo ls /mnt/hdd/${network}/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
||||
blockchainDataExists=$(sudo ls /mnt/hdd/${network}/blocks 2>/dev/null | grep -c '.dat')
|
||||
configExists=$(sudo ls /mnt/hdd/${network}/${network}.conf | grep -c '.conf')
|
||||
|
||||
if [ ${blockchainDataExists} -eq 1 ]; then
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
## get basic info
|
||||
source /home/admin/raspiblitz.info
|
||||
source /mnt/admin/raspiblitz.info
|
||||
|
||||
echo ""
|
||||
echo "*** 60finishHDD.sh ***"
|
||||
|
@ -9,20 +10,14 @@ echo "*** 60finishHDD.sh ***"
|
|||
# use blitz.datadrive.sh to analyse HDD situation
|
||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status ${network})
|
||||
if [ ${#error} -gt 0 ]; then
|
||||
echo "FAIL blitz.datadrive.sh status --> ${error}"
|
||||
echo "Please report issue to the raspiblitz github."
|
||||
echo "# FAIL blitz.datadrive.sh status --> ${error}"
|
||||
echo "# Please report issue to the raspiblitz github."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check that data drive is mounted
|
||||
if [ ${isMounted} -eq 0 ]; then
|
||||
echo "FAIL - HDD is not mounted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if blockchain exists
|
||||
if [ ${hddGotBlockchain} -eq 0 ]; then
|
||||
echo "FAIL - HDD got no blockchain."
|
||||
echo "# FAIL - HDD is not mounted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -57,14 +52,33 @@ fi
|
|||
###### START NETWORK SERVICE
|
||||
echo ""
|
||||
echo "*** Start ${network} ***"
|
||||
echo "This can take a while .."
|
||||
echo "- This can take a while .."
|
||||
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service
|
||||
#sudo chmod +x /etc/systemd/system/${network}d.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable ${network}d.service
|
||||
sudo systemctl start ${network}d.service
|
||||
echo "Started ... wait 10 secs"
|
||||
sleep 10
|
||||
echo "- Started ... wait 20 secs"
|
||||
sleep 20
|
||||
|
||||
# check if bitcoin has started
|
||||
bitcoinRunning=0
|
||||
loopcount=0
|
||||
while [ ${bitcoinRunning} -eq 0 ]
|
||||
do
|
||||
>&2 echo "# (${loopcount}/50) checking if ${network}d is running ... "
|
||||
bitcoinRunning=$(${network}-cli getblockchaininfo 2>/dev/null | grep "initialblockdownload" -c)
|
||||
sleep 2
|
||||
sync
|
||||
loopcount=$(($loopcount +1))
|
||||
if [ ${loopcount} -gt 50 ]; then
|
||||
/home/admin/XXdebugLogs.sh
|
||||
echo "***********************************"
|
||||
echo "FAIL: ${network} failed to start :("
|
||||
echo "Get support or try again the command: raspiblitz"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# set SetupState
|
||||
sudo sed -i "s/^setupStep=.*/setupStep=60/g" /home/admin/raspiblitz.info
|
||||
|
|
|
@ -4,43 +4,43 @@ extraParameter="$1"
|
|||
forceParameter="$2"
|
||||
if [ "${extraParameter}" = "-all" ]; then
|
||||
|
||||
echo "!!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
|
||||
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||
echo "# !!!! This will DELETE ALL DATA & POSSIBLE FUNDS from the HDD !!!!"
|
||||
echo "# Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||
read key
|
||||
|
||||
echo "stopping services ... (please wait)"
|
||||
echo "- swap"
|
||||
echo "# stopping services ... (please wait)"
|
||||
echo "# - swap"
|
||||
sudo dphys-swapfile swapoff
|
||||
echo "- background"
|
||||
echo "# - background"
|
||||
sudo systemctl stop background 2>/dev/null
|
||||
echo "- lnd"
|
||||
echo "# - lnd"
|
||||
sudo systemctl stop lnd.service 2>/dev/null
|
||||
echo "- blockchain"
|
||||
echo "# - blockchain"
|
||||
sudo systemctl stop bitcoind.service 2>/dev/null
|
||||
sudo systemctl stop litecoind.service 2>/dev/null
|
||||
|
||||
# delete plain all on HDD
|
||||
echo "cleaning HDD ... (please wait)"
|
||||
echo "# cleaning HDD ... (please wait)"
|
||||
sudo rm -rfv /mnt/hdd/*
|
||||
|
||||
elif [ "${extraParameter}" = "-blockchain" ]; then
|
||||
|
||||
if [ "${forceParameter}" != "-force" ]; then
|
||||
echo "This will DELETE JUST your blockchain from the HDD."
|
||||
echo "--> It will keep your LND data and other setups."
|
||||
echo "--> You will get presented re-download options."
|
||||
echo "Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||
echo "# This will DELETE JUST your blockchain from the HDD."
|
||||
echo "# --> It will keep your LND data and other setups."
|
||||
echo "# --> You will get presented re-download options."
|
||||
echo "# Press ENTER to really continue - CTRL+c to CANCEL (last chance)"
|
||||
read key
|
||||
fi
|
||||
|
||||
echo "stopping services ... (please wait)"
|
||||
echo "- lnd"
|
||||
echo "# stopping services ... (please wait)"
|
||||
echo "# - lnd"
|
||||
sudo systemctl stop lnd.service 2>/dev/null
|
||||
echo "- blockchain"
|
||||
echo "# - blockchain"
|
||||
sudo systemctl stop bitcoind.service 2>/dev/null
|
||||
sudo systemctl stop litecoind.service 2>/dev/null
|
||||
echo ""
|
||||
echo "DELETING ..."
|
||||
echo "# DELETING ..."
|
||||
|
||||
# delete bitcoin blockchain (but keep config)
|
||||
sudo mv /mnt/hdd/bitcoin/bitcoin.conf /mnt/hdd/bitcoin.conf 2>/dev/null
|
||||
|
|
Loading…
Add table
Reference in a new issue