一个苹果,n种思想~

Today start

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://archive.ubuntu.org.cn/ubuntu/
http://debian.cn99.com/ubuntu/
http://mirror.lupaworld.com/ubuntu/
http://mirrors.kernel.org/ubuntu/
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/
http://mirrors.ccs.neu.edu/archive.ubuntu.com/
http://mirrors.easynews.com/linux/ubuntu/
http://cudlug.cudenver.edu/ubuntu/
http://mirrors.acm.jhu.edu/ubuntu/
http://ubuntu.cs.uaf.edu/ubuntu/
http://mirror.utdlug.org/linux/distributions/ubuntu/packages/
http://apt.ubuntu.org.tw/ubuntu/
http://apt.nc.hcc.edu.tw/pub/ubuntu/
http://ubuntu.csie.ntu.edu.tw/ubuntu/
http://ftp.cse.yzu.edu.tw/pub/Linux/Ubuntu/ubuntu/
http://mirror.nttu.edu.tw/ubuntu/
http://ubuntu.csie.nctu.edu.tw/ubuntu/
http://ubuntu.mithril-linux.org/archives/
http://ftp.cse.yzu.edu.tw/ftp/Linux/Ubuntu/ubuntu-cd/
http://apt.ubuntu.org.tw/releases/
http://ubuntu.csie.ntu.edu.tw/ubuntu-releases/
http://apt.nc.hcc.edu.tw/pub/ubuntu-cd/
http://ubuntu.mithril-linux.org/releases/
http://mirror.letsopen.com/os/ubuntu-ISO/
http://ubuntu.progression-asia.com/

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

中文mandpkg

Write a comment

New comments have been disabled for this post.

June 2012
S M T W T F S
May 2012July 2012
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30