Skip to content

Commit

Permalink
Update speedtest_bestv.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
redrainl authored Aug 3, 2023
1 parent b99c948 commit 4da431f
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions speedtest/speedtest_bestv.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
rm -f speedtest_bestv.log
#!/bin/bash

read -p "确定要运行脚本吗?(y/n): " choice

# 判断用户的选择,如果不是"y"则退出脚本,默认使用文件bestv.ip,带参数则以参数为ip文件名
if [ "$choice" != "y" ]; then
echo "脚本已取消."
exit 0
fi

time=$(date +%m%d%H%M)
i=0

if [ $# -gt 0 ]; then
filename="$1"
else
filename="bestv.ip"
fi

while read line; do

i=$(($i+1));
ip=$line
date1=$(date +%Y%m%d%H)
a=$(date +%s)
a=${a:0:9}
a=`expr $a - 7`
url2="$date1/$a.ts"
url="http://$ip/liveplay-kk.rtxapp.com/live/program/live/cctv1hd8m/8000000/$url2"
curl $url --connect-timeout 2 --max-time 15 -o /dev/null >dl.log 2>&1
a=$(tail -n 1 dl.log|awk '{print $NF}')
# url="http://$ip/liveplay-kk.rtxapp.com/live/program/live/cctv1hd8m/8000000/$url2"

url="http://$ip/liveplay-kk.rtxapp.com/live/program/live/gswshd8m/8000000/$url2"
echo $url
curl $url --connect-timeout 2 --max-time 15 -o /dev/null >bestv.tmp 2>&1
a=$(tail -n 1 bestv.tmp|awk '{print $NF}')
echo "$i个: $ip $a"
echo "$ip $a">> speedtest_bestv.log

done
cat speedtest_bestv.log |grep M|awk '{print $2" " $1}'|sort -r |head -n 10
echo "$ip $a">> speedtest_bestv$time.log


done <"$filename"
rm -f bestv.tmp
cat speedtest_bestv$time.log |grep -E 'M|k'|awk '{print $2" " $1}'|sort -n -r

0 comments on commit 4da431f

Please sign in to comment.