From 2e89504c9e143b731e0ef3b057a2a4e6dcb64240 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Wed, 28 Nov 2018 23:29:37 +0100 Subject: [PATCH] change detecting presync --- home.admin/_bootstrap.presync.sh | 4 ++++ home.admin/_bootstrap.sh | 18 +++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/home.admin/_bootstrap.presync.sh b/home.admin/_bootstrap.presync.sh index bebc1c30b..4fb32dcff 100644 --- a/home.admin/_bootstrap.presync.sh +++ b/home.admin/_bootstrap.presync.sh @@ -16,6 +16,10 @@ infoFile="/home/admin/raspiblitz.info" echo "presync: waiting 2 secs" >> $logFile sleep 2 +# just in case an old presync did not shutdown properly +sudo systemctl stop bitcoind.service 2>/dev/null +sudo systemctl disable bitcoind.service 2>/dev/null + echo "presync: copying files" >> $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 diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 6b46f1c22..be600d907 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -186,19 +186,19 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then echo "Found pre-loaded blockchain" >> $logFile # check if pre-sync was already activated on last power-on - presyncActive=$(systemctl status bitcoind | grep -c 'could not be found') - if [ ${presyncActive} -eq 1]; then + #presyncActive=$(systemctl status bitcoind | grep -c 'could not be found') + #if [ ${presyncActive} -eq 1]; 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 & - else - echo "pre-sync is already active" >> $logFile - # update info file - echo "state=presync" > $infoFile - echo "message='pre-sync active'" >> $infoFile - echo "device=${hddDeviceName}" >> $infoFile - fi + #else + # echo "pre-sync is already active" >> $logFile + # # update info file + # echo "state=presync" > $infoFile + # echo "message='pre-sync active'" >> $infoFile + # echo "device=${hddDeviceName}" >> $infoFile + #fi # after admin login, presync will be stoped and HDD unmounted exit 1