From 59bebe31bda68f56e5f7169b8780c572cf44f8b0 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Mon, 19 Aug 2019 23:39:10 -0500 Subject: [PATCH] Improve quicksync speed management --- rootfs/standard/usr/bin/mynode_bandwidth.sh | 4 ++++ rootfs/standard/usr/bin/mynode_quicksync.sh | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/rootfs/standard/usr/bin/mynode_bandwidth.sh b/rootfs/standard/usr/bin/mynode_bandwidth.sh index 44e2720d..5fc2da9e 100755 --- a/rootfs/standard/usr/bin/mynode_bandwidth.sh +++ b/rootfs/standard/usr/bin/mynode_bandwidth.sh @@ -32,6 +32,7 @@ done echo "QuickSync Complete! Enabling Uploading." while true; do + PERCENT=$(transmission-remote -t 1 -i | grep "Percent Done:") if [ -f $UPLOADER_FILE ]; then echo "Marked as uploader, unlimited upload" transmission-remote -U @@ -41,6 +42,9 @@ while true; do elif [ ! -f "/mnt/hdd/mynode/.mynode_bitcoind_synced" ]; then echo "Bitcoin not synced, stopping upload" transmission-remote -u 0 + elif [[ "$PERCENT" != *"100"* ]]; then + echo "QuickSync is downloading, stopping upload" + transmission-remote -u 0 elif [ -f $QUICKSYNC_BANDWIDTH_FILE ]; then RATE=$(cat $QUICKSYNC_BANDWIDTH_FILE) echo "Setting upload rate to $RATE kbps" diff --git a/rootfs/standard/usr/bin/mynode_quicksync.sh b/rootfs/standard/usr/bin/mynode_quicksync.sh index 40aad87c..9b8553e9 100755 --- a/rootfs/standard/usr/bin/mynode_quicksync.sh +++ b/rootfs/standard/usr/bin/mynode_quicksync.sh @@ -84,16 +84,17 @@ else if [ $COMPLETED -eq 1 ]; then touch $QUICKSYNC_DIR/.quicksync_download_complete touch $QUICKSYNC_DIR/.quicksync_complete - - # Since this will start/continue a background download, wait so everything else boots smoothly - sleep 5m - /usr/bin/wait_on_bitcoin.sh - sleep 10m fi sync fi fi +# If Quicksync has already completed, let's give BTC some time to start +if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then + /usr/bin/wait_on_bitcoin.sh + sleep 5m +fi + # Start torrent echo "Running torrent..." transmission-cli \