Skip to content

Commit

Permalink
修复进程管理bug
Browse files Browse the repository at this point in the history
  • Loading branch information
badafans authored Sep 24, 2020
1 parent eb4b410 commit d9a67b6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ do
do
declare -i n
declare -i per
rm -rf icmp temp log.txt
rm -rf icmp temp log.txt anycast.txt
mkdir icmp
curl https://anycast.freecdn.workers.dev -s -# -o anycast.txt
n=0
m=$(curl https://anycast.freecdn.workers.dev -s | wc -l)
for i in `curl https://anycast.freecdn.workers.dev -s`
m=$(cat anycast.txt | wc -l)
for i in `cat anycast.txt`
do
ping -c 60 -i 0.2 -n -q $i > icmp/$n.log&
per=$n*100/$m
Expand All @@ -33,6 +34,19 @@ do
fi
done
done
rm -rf anycast.txt
while true
do
p=$(ps -ef | grep ping | grep -v "grep" | wc -l)
if [ $p -ne 0 ]
then
echo 等待 ICMP 进程结束:剩余进程数 $p
sleep 1
else
echo ICMP 丢包率测试完成
break
fi
done
cat icmp/*.log | sed -n '3~5p;4~5p' | sed -n '{N;s/\n/\t/p}' | cut -f1 -d'%' | awk '{print $2,$NF}' | sort -k 2 -n | awk '{print $1}' | sed '101,$d' > ip.txt
rm -rf icmp
echo 选取100个丢包率最少的IP地址下载测速
Expand Down

0 comments on commit d9a67b6

Please sign in to comment.