Modifying the value DELETED_SEQUENCES_OFF in the script from 0 to 1 as per bug/error...
[pingpong.git] / vpn / run-in-loop.sh
1 #!/bin/sh
2
3 FILE_TO_INJECT=$1
4 #RAND_START=0
5 #RAND_END=60
6 TIMES=101
7
8 COUNT=1
9 while [ $COUNT -lt $TIMES ]
10 do
11         #RAND=$[`shuf -i $RAND_START-$RAND_END -n 1`]
12         #RAND="$(awk 'BEGIN{srand();print int(rand()*60)}')"
13         # This one works well to generate a random number between 0-999 on OpenWrt
14         RAND=$(head -30 /dev/urandom | tr -dc "0123456789" | head -c3)
15         sleep $(($RAND%240))
16         tcpreplay -i eth1 -q "$FILE_TO_INJECT"
17         echo "Delay for $FILE_TO_INJECT: $(($RAND%240)) seconds"
18         date +"%m/%d/%Y %r"
19         COUNT=`expr $COUNT + 1`
20 done