- **长时灌包脚本 **
使用iperf时通常加-t来指定发包时间,但是该时间 有长度限制,不同版本不同,一般不超过24小时,如果想做24 h x7 的拷机,则需要更长的时间 ,下面编写两种长时发包脚本 。
windows平台长时发包
通过设置dayNo可修改要发包的持续天数。
@echo off
:: set the no. of days
set dayNo=7
::set timePerday=86400
set timePerday=2
for /l %%a in (1,1, %dayNo% ) do (
echo day: %%a
::进入 iperf路径
iperf3.exe -c 对端IP -B 本地IP -i 1 -t %timePerday% -l 1400 -p 12345 -b 30m
echo.
)
pause
Linux平台长时发包
直接将以下内容粘贴到linux终端中,则自动创建一个longIperf脚本 ,并增加执行权限。
sudo cat > /usr/bin/longIperf << "EOF"
#!/bin/bash
if [ $# -ge 1 ];then
echo -e "Iperf run $1 days"
elif [ $# -ge 0 ];then
echo -e Usage: longIperf no.ofDay
exit
fi
day=$1
for i in $(seq 1 $day)
do
echo "Day $i:" "\t" $(date "+%Y-%m-%d %H:%M:%S \t")
iperf3 -c 172.17.10.146 -i 1 -t 86400 -l 1400 -p 5011 -b 30m
echo
done
EOF
sudo chmod +x /usr/bin/longIperf
The End.