Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find closest server
#!/bin/sh
set -eu
count=$1
server=$2
latency=$(ping -nqc${count} ${server} |
sed -nE 's,^round[^=]*=[^/]*/([[:digit:]]+\.[[:digit:]]+).*,\1,p')
echo "${latency} ${server}"
#!/bin/sh
set -eu
PARALLEL=${PARALLEL:-64}
COUNT=${COUNT:-6}
xargs \
-P $PARALLEL \
-n 1 \
sh ping_server.sh $COUNT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.