torrent fix

This commit is contained in:
rootzoll
2018-07-25 17:58:27 +02:00
parent ce36c99dae
commit d9efbd5d2a

View File

@@ -17,11 +17,16 @@ if [ ${mountOK} -eq 1 ]; then
# HDD is empty - download HDD content # HDD is empty - download HDD content
echo "OK - HDD is ready." echo "OK - HDD is ready."
echo "" echo ""
downloading=1
retry=0
while [ $downloading -eq 1 ]
do
echo "*** Downloading HDD ***" echo "*** Downloading HDD ***"
tmpfile=$(mktemp) tmpfile=$(mktemp)
chmod a+x $tmpfile chmod a+x $tmpfile
echo "killall transmission-cli" > $tmpfile echo "killall transmission-cli" > $tmpfile
sudo transmission-cli ./assets/$torrent.torrent -D -w /mnt/hdd -f $tmpfile sudo transmission-cli ./assets/$torrent.torrent -D -et -w /mnt/hdd -f $tmpfile
echo "" echo ""
echo "*** Checking Download ***" echo "*** Checking Download ***"
echo "wait a moment" echo "wait a moment"
@@ -34,7 +39,23 @@ if [ ${mountOK} -eq 1 ]; then
torrentsize="$(($torrentsize-1024000))" torrentsize="$(($torrentsize-1024000))"
echo "download size is(${downloadsize})" echo "download size is(${downloadsize})"
if [ ${downloadsize} -lt ${torrentsize} ]; then if [ ${downloadsize} -lt ${torrentsize} ]; then
echo ""
echo "FAIL - download is not ${torrentsize}" echo "FAIL - download is not ${torrentsize}"
retry=$(($retry+1))
if [ ${retry} -gt 2 ]; then
echo "All Retry FAILED"
downloading=0
else
echo "--> RETRY(${retry}) in 10 secs"
sleep 10
echo ""
fi
else
echo "OK - Download is complete"
downloading=0
fi
done
if [ ${downloadsize} -lt ${torrentsize} ]; then
sleep 3 sleep 3
dialog --title " WARNING " --yesno "The download failed or is not complete. Do you want to clean all download data before you continue?" 6 57 dialog --title " WARNING " --yesno "The download failed or is not complete. Do you want to clean all download data before you continue?" 6 57
response=$? response=$?