|
@ -15,10 +15,6 @@ litecoinSize=19180000 # 19184960-tolerance |
|
|
# load network |
|
|
# load network |
|
|
network=`cat .network` |
|
|
network=`cat .network` |
|
|
|
|
|
|
|
|
# make sure lftp is available |
|
|
|
|
|
# sudo apt-get install lftp -y |
|
|
|
|
|
# echo "" |
|
|
|
|
|
|
|
|
|
|
|
# settings based on network |
|
|
# settings based on network |
|
|
list=$bitcoinList |
|
|
list=$bitcoinList |
|
|
url=$bitcoinUrl |
|
|
url=$bitcoinUrl |
|
@ -33,7 +29,6 @@ fi |
|
|
name="Download" |
|
|
name="Download" |
|
|
targetDir="/mnt/hdd/download/" |
|
|
targetDir="/mnt/hdd/download/" |
|
|
targetSize=$size |
|
|
targetSize=$size |
|
|
maxTimeoutLoops=100000 |
|
|
|
|
|
command="sudo wget -c -r -P ${targetDir} -q --show-progress ${url}" |
|
|
command="sudo wget -c -r -P ${targetDir} -q --show-progress ${url}" |
|
|
|
|
|
|
|
|
# starting session if needed |
|
|
# starting session if needed |
|
@ -53,8 +48,6 @@ sleep 3 |
|
|
# monitor session |
|
|
# monitor session |
|
|
screenDump="... started ..." |
|
|
screenDump="... started ..." |
|
|
actualSize=0 |
|
|
actualSize=0 |
|
|
timeout=1 |
|
|
|
|
|
timeoutInfo="-" |
|
|
|
|
|
while : |
|
|
while : |
|
|
do |
|
|
do |
|
|
|
|
|
|
|
@ -62,7 +55,6 @@ while : |
|
|
screen -wipe 1>/dev/null |
|
|
screen -wipe 1>/dev/null |
|
|
isRunning=$( screen -S ${name} -ls | grep "${name}" -c ) |
|
|
isRunning=$( screen -S ${name} -ls | grep "${name}" -c ) |
|
|
if [ ${isRunning} -eq 0 ]; then |
|
|
if [ ${isRunning} -eq 0 ]; then |
|
|
timeout=0 |
|
|
|
|
|
echo "OK - session finished" |
|
|
echo "OK - session finished" |
|
|
break |
|
|
break |
|
|
fi |
|
|
fi |
|
@ -75,28 +67,13 @@ while : |
|
|
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc) |
|
|
progress=$(echo "scale=2; $freshSize*100/$targetSize" | bc) |
|
|
echo $progress > ".${name}.progress" |
|
|
echo $progress > ".${name}.progress" |
|
|
|
|
|
|
|
|
# detect if since last loop any progress occured |
|
|
|
|
|
if [ ${actualSize} -eq ${freshSize} ]; then |
|
|
|
|
|
timeoutInfo="${timeout}/${maxTimeoutLoops}" |
|
|
|
|
|
timeout=$(( $timeout + 1 )) |
|
|
|
|
|
else |
|
|
|
|
|
timeout=1 |
|
|
|
|
|
timeoutInfo="no timeout detected" |
|
|
|
|
|
fi |
|
|
|
|
|
actualSize=$freshSize |
|
|
actualSize=$freshSize |
|
|
|
|
|
|
|
|
# detect if mx timeout loop limit is reached |
|
|
|
|
|
if [ ${timeout} -gt ${maxTimeoutLoops} ]; then |
|
|
|
|
|
echo "FAIL - download hit timeout" |
|
|
|
|
|
break |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# display info screen |
|
|
# display info screen |
|
|
clear |
|
|
clear |
|
|
echo "****************************************************" |
|
|
echo "****************************************************" |
|
|
echo "Monitoring Screen Session: ${name}" |
|
|
echo "Monitoring Screen Session: ${name}" |
|
|
echo "Progress: ${progress}% (${actualSize} of ${targetSize})" |
|
|
echo "Progress: ${progress}% (${actualSize} of ${targetSize})" |
|
|
echo "Timeout: ${timeoutInfo}" |
|
|
|
|
|
echo "If needed press key x to stop ${name}" |
|
|
echo "If needed press key x to stop ${name}" |
|
|
echo "NOTICE: This can take multiple hours or days !!" |
|
|
echo "NOTICE: This can take multiple hours or days !!" |
|
|
echo "Its OK to close terminal now and SSH back in later." |
|
|
echo "Its OK to close terminal now and SSH back in later." |
|
|