mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
improve for replacing old blockchain case
This commit is contained in:
parent
84c0b2f0f4
commit
c818a5cf77
1 changed files with 15 additions and 0 deletions
|
@ -6,7 +6,20 @@ source /home/admin/raspiblitz.info
|
||||||
# get local ip
|
# get local ip
|
||||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
|
|
||||||
|
# additional prep if this is used to replace corrupted blockchain
|
||||||
|
if [ "${setupStep}" = "100" ]; then
|
||||||
|
# warn user
|
||||||
|
echo "!! Press ENTER to delete the old blockchain .. CTRL+C to CANCEL"
|
||||||
|
read key
|
||||||
|
# make sure services are not running
|
||||||
|
echo "stopping servcies ..."
|
||||||
|
sudo systemctl stop lnd
|
||||||
|
sudo systemctl stop bitcoind
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# create bitcoin base directory and link with bitcoin user
|
# create bitcoin base directory and link with bitcoin user
|
||||||
|
echo "delete and create new blockchain directory ..."
|
||||||
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null
|
sudo rm -rf /mnt/hdd/bitcoin 2>/dev/null
|
||||||
sudo rm -rf /home/bitcoin/.bitcoin 2>/dev/null
|
sudo rm -rf /home/bitcoin/.bitcoin 2>/dev/null
|
||||||
sudo mkdir /mnt/hdd/bitcoin
|
sudo mkdir /mnt/hdd/bitcoin
|
||||||
|
@ -14,6 +27,7 @@ sudo chown bitcoin:bitcoin /mnt/hdd/bitcoin
|
||||||
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
|
sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin
|
||||||
|
|
||||||
# check setup
|
# check setup
|
||||||
|
echo "checking setup ..."
|
||||||
sudo touch /home/bitcoin/.bitcoin/test.txt
|
sudo touch /home/bitcoin/.bitcoin/test.txt
|
||||||
createdCorerct=$(sudo ls /mnt/hdd/bitcoin/test.txt | grep -c 'test.txt')
|
createdCorerct=$(sudo ls /mnt/hdd/bitcoin/test.txt | grep -c 'test.txt')
|
||||||
sudo rm /home/bitcoin/.bitcoin/test.txt
|
sudo rm /home/bitcoin/.bitcoin/test.txt
|
||||||
|
@ -23,6 +37,7 @@ if [ ${createdCorerct} -eq 0 ]; then
|
||||||
echo "FAILED: sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin"
|
echo "FAILED: sudo ln -s /mnt/hdd/bitcoin /home/bitcoin/.bitcoin"
|
||||||
echo "Press ENTER to get back to menu ..."
|
echo "Press ENTER to get back to menu ..."
|
||||||
read key
|
read key
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
Loading…
Add table
Reference in a new issue