mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-13 06:09:47 +02:00
simplyfied presync
This commit is contained in:
parent
b7802b8f6f
commit
3482c58eb0
@ -97,7 +97,7 @@ while :
|
||||
source /home/admin/raspiblitz.info
|
||||
if [ "${state}" = "presync" ]; then
|
||||
# get blockchain sync progress
|
||||
blockchaininfo="$(bitcoin-cli -datadir=/mnt/hdd/bitcoin getblockchaininfo 2>/dev/null)"
|
||||
blockchaininfo="$(sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf getblockchaininfo 2>/dev/null)"
|
||||
if [ ${#blockchaininfo} -gt 0 ]; then
|
||||
message="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
|
||||
fi
|
||||
|
@ -16,14 +16,14 @@ if [ ${bootstrapInfoExists} -eq 1 ]; then
|
||||
echo "********************************************"
|
||||
echo "Stopping pre-sync ... pls wait (up to 1min)"
|
||||
echo "********************************************"
|
||||
sudo systemctl stop bitcoind.service
|
||||
sudo systemctl disable bitcoind.service
|
||||
sudo rm /mnt/hdd/bitcoin/bitcoin.conf
|
||||
sudo rm /etc/systemd/system/bitcoind.service
|
||||
sudo unlink /home/bitcoin/.bitcoin
|
||||
sudo -u root bitcoin-cli -conf=/home/admin/assets/bitcoin.conf stop
|
||||
echo "bitcoind called to stop .."
|
||||
sleep 10
|
||||
|
||||
# unmount the temporary mount
|
||||
echo "Unmount HDD .."
|
||||
sudo umount -l /mnt/hdd
|
||||
sleep 3
|
||||
|
||||
# update info file
|
||||
state=waitsetup
|
||||
|
@ -15,7 +15,7 @@ infoFile="/home/admin/raspiblitz.info"
|
||||
#sudo systemctl stop bitcoind.service 2>/dev/null
|
||||
#sudo systemctl disable bitcoind.service 2>/dev/null
|
||||
|
||||
echo "presync: bitcoind" >> $logFile
|
||||
#echo "presync: bitcoind" >> $logFile
|
||||
#sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf
|
||||
#sudo cp /home/admin/assets/bitcoind.service /etc/systemd/system/bitcoind.service
|
||||
#sudo chmod +x /etc/systemd/system/bitcoind.service
|
||||
@ -24,10 +24,10 @@ echo "presync: bitcoind" >> $logFile
|
||||
#sudo systemctl daemon-reload
|
||||
#sudo systemctl enable bitcoind.service
|
||||
#sudo systemctl start bitcoind.service
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin
|
||||
sudo -u bitcoin /usr/local/bin/bitcoind -daemon -conf=/home/admin/assets/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid
|
||||
echo "presync: started" >> $logFile
|
||||
#sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin
|
||||
#sudo -u bitcoin /usr/local/bin/bitcoind -daemon -conf=/home/admin/assets/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid
|
||||
#echo "presync: started" >> $logFile
|
||||
|
||||
# update info file
|
||||
echo "state=presync" > $infoFile
|
||||
sudo sed -i "s/^message=.*/message='running pre-sync'/g" ${infoFile}
|
||||
#echo "state=presync" > $infoFile
|
||||
#sudo sed -i "s/^message=.*/message='running pre-sync'/g" ${infoFile}
|
||||
|
@ -187,7 +187,7 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
|
||||
# update info file
|
||||
echo "state=presync" > $infoFile
|
||||
echo "message='starting pre-sync'" >> $infoFile
|
||||
echo "message='starting presync'" >> $infoFile
|
||||
|
||||
# activating presync
|
||||
# so that on a hackathon you can just connect a RaspiBlitz
|
||||
@ -199,9 +199,10 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then
|
||||
echo "starting pre-sync in background" >> $logFile
|
||||
# starting in background, because this scripts is part of systemd
|
||||
# so to change systemd needs to happen after delay in seperate process
|
||||
/home/admin/_bootstrap.presync.sh &
|
||||
echo "done" >> $logFile
|
||||
|
||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/bitcoin 2>> $logFile
|
||||
sudo -u bitcoin /usr/local/bin/bitcoind -daemon -conf=/home/admin/assets/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid 2>> $logFile
|
||||
echo "OK Started bitcoind for presync" >> $logFile
|
||||
sudo sed -i "s/^message=.*/message='running presync'/g" ${infoFile}
|
||||
# after admin login, presync will be stoped and HDD unmounted
|
||||
exit 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user