Created
December 29, 2022 04:51
-
-
Save robvanoostenrijk/2d51a15eae0c3d6343c7244d5e672d2a to your computer and use it in GitHub Desktop.
Determine fastest Alpine mirror
This file contains 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/sh | |
echo "Top 5 Alpine Mirrors:" | |
for MIRROR in $(curl -s http://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt) | |
do | |
MEASUREMENT=$(curl -s --connect-timeout 2 --max-time 5 -w '%{time_total}' -o /dev/null "$MIRROR") | |
TIME=$(echo "scale=0;(${MEASUREMENT} * 1000)/1" | bc) | |
echo "${TIME} ${MIRROR}" | |
done | sort -n | head -n5 | cut -d " " -f2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment