rendered paste body#!/bin/bashecho "New file: hash "$1" size "$2" name "$3""#get hash value, last 32 (+1 NL?) charsmatch=`echo $1 | tail -c 33`echo "match "$match""rounds=60if [ `echo $1 | head -c 2` != "BT" ]then#for non torrent downloads for (( i = 1 ; i <= $rounds; i++ )) do if [ `find /home/kdo/mldonkey/newincoming/ -maxdepth 1 -cmin 1 -size ${2}c -type f | wc -l` -eq 0 ] then sleep 3 echo "Wait 3 seconds" if test $i -eq $rounds then echo "No new file found." exit 1 fi fi done result=`find /home/kdo/mldonkey/newincoming/ -maxdepth 1 -cmin 1 -size ${2}c -type f | head -n1`else#for torrent downloads, risky, but works in most cases for (( i = 1 ; i <= $rounds; i++ )) do if [ `find /home/kdo/mldonkey/newincoming/ -mindepth 1 -maxdepth 0 -cmin 1 | wc -l` -eq 0 ] then sleep 3 echo "Wait 3 seconds" if test $i -eq $rounds then echo "No new file found." exit 1 fi fi done result=`find /home/kdo/mldonkey/newincoming/ -mindepth 1 -maxdepth 0 -cmin 1 | head -n1`fi#wait some time so directories from bittorent can be moved, just for suresleep 5#prevent from some simple hacksif [ `echo $1 | head -c 1` == "*" ]then exit 1fiif [ `echo $1 | head -c 1` == "." ]then exit 1firem=1echo "Found file: "$result""case $match inD561DFE2FD3EDA1A9E39040110B8F767) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;81D644535B68E286AD3C27418B763D8B) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;025D2A7BD0BAE1F0B8D73E888158E611) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;2A2B0786B1A8216F53F51AF7AD2FA058) rem=0 ;;E7779C0157FEFA46FD21B31280F67ECD) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;7577627A48BE538C83FE1CF6A4BE2F5B) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;0C938E79488F8EA6F8F7DECE1828FE8F) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;04ADDBD4D41F53D392A22DD13273DC11) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;F89179E3A9A7F065C1F8738536F2C22A) cp -r "$result" /home/kdo/mldonkey/newincoming/piero/ || rem=0 ;;*) echo "identifier not scheduled" rem=0 exit 1 ;;esacif [ $rem -eq 1 ]then rm -r "$result" echo 'File moved.' echo 'File in /home/kdo/mldonkey/newincoming/ deleted.'else echo 'File not moved.'fi