Content

random noises emanating from the boston area

Quick and dirty Ubuntu mirror chooser

Monday 10 July 2006 - Filed under Software

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

2006-07-10  »  mark

Share your thoughts

Re: Quick and dirty Ubuntu mirror chooser







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>