From f64d579f653a1b67b47c480faca2387b14bcf98a Mon Sep 17 00:00:00 2001 From: rootzoll Date: Tue, 27 Nov 2018 18:24:09 +0100 Subject: [PATCH] presync when active --- home.admin/_bootstrap.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 919128df6..bd1b6e09d 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -183,10 +183,22 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then # activating presync # so that on a hackathon you can just connect a RaspiBlitz # to the network and have it up-to-date for setting up - echo "Found pre-loaded blockchain - 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 "Found pre-loaded blockchain" >> $logFile + + # check if pre-sync was already activated on last power-on + presyncActive=$(ls /etc/systemd/system/bitcoind.service | grep -c '.service') + if [ ${presyncActive} -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 & + 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