Last active
April 22, 2019 01:35
-
-
Save maxguru/8b219146722623ff233c421328465bd1 to your computer and use it in GitHub Desktop.
Script for testing latency to VPS providers listed in vps.txt file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
echo > pingresults.txt | |
date | |
cat vps.txt | while read LINE | |
do | |
IP=`echo $LINE | cut -d '#' -f 1` | |
DC=`echo $LINE | cut -d '#' -f 2` | |
echo "Pinging $IP..." | |
#PING=`ping -c 4 -i 0 "$IP" | tail -1 | awk '{print $4}' | cut -d '/' -f 2` | |
PING=`hping3 -c 1 -S -p 80 "$IP" 2>/dev/null | tail -1 | awk -F'rtt=' '{print $2}'` | |
echo "$PING , $DC , $IP" >> pingresults.txt | |
done | |
cat pingresults.txt | sort -t, -nk1 | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment