change detecting presync

This commit is contained in:
rootzoll 2018-11-28 23:29:37 +01:00
parent 71cbf27fff
commit 2e89504c9e
2 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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