mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-14 01:19:16 +00:00
33 lines
918 B
Bash
Executable File
33 lines
918 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
source /usr/share/mynode/mynode_config.sh
|
|
|
|
if [ -f $QUICKSYNC_DIR/.quicksync_complete ] && [ -f $QUICKSYNC_DIR/.quicksync_download_complete ]; then
|
|
echo "Exiting quicksync_complete. Quicksync already completed. This was just a re-download."
|
|
exit 0
|
|
fi
|
|
|
|
# Mark download complete
|
|
touch $QUICKSYNC_DIR/.quicksync_download_complete
|
|
sync
|
|
|
|
# Copy files
|
|
echo "quicksync_copy" > $MYNODE_DIR/.mynode_status
|
|
rm -rf $MYNODE_DIR/bitcoin/blocks/
|
|
rm -rf $MYNODE_DIR/bitcoin/chainstate/
|
|
tar -xvf $QUICKSYNC_DIR/blockchain*.tar.gz -C $MYNODE_DIR/bitcoin/ --dereference 2>&1 > /tmp/tar_log_$(date +%s)
|
|
#pv -L 10m $QUICKSYNC_DIR/blockchain*.tar.gz | tar xzvf - -C $MYNODE_DIR/bitcoin/ --dereference
|
|
|
|
sync
|
|
sleep 30s
|
|
|
|
# Mark quicksync complete and give BTC a few minutes to startup with its new data
|
|
touch $QUICKSYNC_DIR/.quicksync_complete
|
|
sync
|
|
sleep 5m
|
|
echo "stable" > $MYNODE_DIR/.mynode_status
|
|
sync
|
|
|
|
exit 0 |