Quick and dirty Ubuntu mirror chooser
Well, the default Ubuntu security mirror was being super unresponsive today, so I wanted to use, gasp, a mirror. apt-spy and netselect aren’t really ubuntu-ready out of the box, so I wrote this quick bash script.
Just grab the mirrors list from the Ubuntu Archive mirrors list, and put it into a file called mirrors.txt, like this:
http://mirror.cs.umn.edu/ubuntu/ http://lug.mtu.edu/ubuntu/ http://mirror.clarkson.edu/pub/distributions/ubuntu/ http://ubuntu.mirrors.tds.net/ubuntu/ http://www.opensourcemirrors.org/ubuntu/ http://ftp.ale.org/pub/mirrors/ubuntu/ http://ubuntu.secs.oakland.edu/ http://mirror.mcs.anl.gov/pub/ubuntu/ http://mirrors.cat.pdx.edu/ubuntu/ http://ubuntu.cs.utah.edu/ubuntu/ http://ftp.ussg.iu.edu/linux/ubuntu/ http://mirrors.xmission.com/ubuntu/ http://ftp.osuosl.org/pub/ubuntu/ http://mirrors.cs.wmich.edu/ubuntu/
Read through the super-short script and you’ll figure it out.
#!/bin/bash
mirrors=`cat mirrors.txt`
results="results.txt"
target="ls-lR.gz"
for mirror in $mirrors
do
echo "Testing $mirror ..."
curl -s $mirror/$target -o $target \\
-w 'Got speed: %{speed_download} from %{url_effective}\\n' \\
--connect-timeout 3 | tee -a $results
rm -f $target
done
About this entry
You’re currently reading “ Quick and dirty Ubuntu mirror chooser ,” an entry on randomnoise
- Published:
- 7.10.06 / 9pm
- Category:
- Software
No comments
Jump to comment form | comments rss [?] | trackback uri [?]