BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / linux / #24700同步于 2007/8/2
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Linux机器人发帖

[转]一个找出最快安装源的脚本

yifengcn
2007/8/2镜像同步0 回复
不小心看到的,没测。用wget测试速度,会打印出最快的安装源。不过还是有用的,自己再添加点东西,就可以让每次下载东西时,让自己的linux安装程序选择最快的源。虽然这个是针对ubuntu的。但容易想象可以用于其他很多下载场景。 #!/bin/bash if [ $# != 1 -a "$1" != "hoary" -a "$1" != "breezy" ] ; then echo "$0 (hoary|breezy)" exit 1 fi echo "Seting $1 ..." MIRRORS="http://ftp.iinet.net.au/pub/ubuntu/ \ http://mirror.optus.net/ubuntu/ \ http://mirror.isp.net.au/ftp/pub/ubuntu/ \ http://www.planetmirror.com/pub/ubuntu/ \ http://ftp.filearena.net/pub/ubuntu/ \ http://mirror.pacific.net.au/linux/ubuntu/ \ http://ubuntu.inode.at/ubuntu/ \ http://ubuntu.uni-klu.ac.at/ubuntu/ \ http://gd.tuwien.ac.at/opsys/linux/ubuntu/archive/ \ http://ftp.belnet.be/pub/mirror/ubuntu.com/ \ http://ubuntu.mirrors.skynet.be/pub/ubuntu.com/ \ http://mirror.freax.be/ubuntu/archive.ubuntu.com/ \ http://espelhos.edugraf.ufsc.br/ubuntu/ \ http://ubuntu.interlegis.gov.br/archive/ \ http://ubuntu.c3sl.ufpr.br/ubuntu/ \ http://mirror.cpsc.ucalgary.ca/mirror/ubuntu.com/ \ http://mirror.arcticnetwork.ca/pub/ubuntu/packages/ \ http://archive.ubuntu.org.cn/ubuntu/ \ http://debian.cn99.com/ubuntu/ \ http://mirror.lupaworld.com/ubuntu/ \ http://ftp.ucr.ac.cr/ubuntu/ \ http://archive.ubuntu.cz/ubuntu/ \ http://ubuntu.supp.name/ubuntu/ \ http://mirrors.dk.telia.net/ubuntu/ \ http://mirrors.dotsrc.org/ubuntu/ \ http://klid.dk/homeftp/ubuntu/ \ http://ftp.estpak.ee/pub/ubuntu/ \ http://www.nic.funet.fi/pub/mirrors/archive.ubuntu.com/ \ http://mir1.ovh.net/ubuntu/ubuntu/ \ http://fr.archive.ubuntu.com/ubuntu/ \ http://ftp.u-picardie.fr/pub/ubuntu/ubuntu/ \ http://ftp.oleane.net/pub/ubuntu/ \ http://debian.charite.de/ubuntu/ \ http://ftp.inf.tu-dresden.de/os/linux/dists/ubuntu \ http://www.artfiles.org/ubuntu.com \ http://ftp.rz.tu-bs.de/pub/mirror/ubuntu-packages/ \ http://www.ftp.uni-erlangen.de/pub/mirrors/ubuntu/ \ http://debian.tu-bs.de/ubuntu \ http://ftp.ntua.gr/pub/linux/ubuntu/ \ http://ftp.kfki.hu/linux/ubuntu/ \ http://komo.vlsm.org/ubuntu/ \ http://kambing.vlsm.org/ubuntu/ \ http://ubuntu.odg.cc/ \ http://ubuntu.lhi.is/ \ http://ftp.esat.net/mirrors/archive.ubuntu.com/ \ http://ftp.heanet.ie/pub/ubuntu/ \ http://ftp.linux.it/ubuntu/ \ http://na.mirror.garr.it/mirrors/ubuntu-archive/ \ http://ubuntu.mithril-linux.org/archives/ \ http://mirror.letsopen.com/os/ubuntu/ \ http://ftp.kaist.ac.kr/pub/ubuntu/ \ http://ubuntu-arch.linux.edu.lv/ubuntu/ \ http://ftp.litnet.lt/pub/ubuntu/ \ http://nl.archive.ubuntu.com/ubuntu/ \ http://ubuntu.synssans.nl \ http://www.computacion.uni.edu.ni/iso/ubuntu/ \ http://no.archive.ubuntu.com/ubuntu/ \ http://ubuntulinux.mainseek.com/ubuntu/ \ http://ubuntu.task.gda.pl/ubuntu/ \ http://darkstar.ist.utl.pt/ubuntu/archive/ \ http://ubuntu.dcc.fc.up.pt/ \ http://ftp.iasi.roedu.net/mirrors/ubuntulinux.org/ubuntu/ \ http://ftp.lug.ro/ubuntu/ \ http://debian.nsu.ru/ubuntu/ \ http://ftp.acc.umu.se/mirror/ubuntu/ \ http://mirror.switch.ch/ftp/mirror/ubuntu/ \ 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/ftp/Linux/Ubuntu/ubuntu/ \ http://godel.cs.bilgi.edu.tr/mirror/ubuntu/ \ http://www.mirror.ac.uk/mirror/archive.ubuntu.com/ubuntu/ \ http://ubuntu.blueyonder.co.uk/archive/ \ 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/" TIME="/usr/bin/time -o timer.txt -f %e" URL="dists/$1/main/binary-i386/Packages.gz" WGET="wget --cache=off -T 20 -t 1 -w 0 -O /dev/null" PAYTIME=1000 TEMPTIME=1000 SITE="NONE" for mirror in $MIRRORS; do echo "Testing $mirror ..." TEMPTIME=$($TIME $WGET $mirror$URL) if [ "$?" = 0 ] ; then TEMPTIME=$(cat timer.txt) echo "wget $1: $TEMPTIME CurrMinTime: $PAYTIME" TEMPTIME2=$(echo "$PAYTIME> $TEMPTIME"|bc) if [ $TEMPTIME2 = 1 ] ; then PAYTIME=$TEMPTIME SITE=$mirror echo "Set best site($PAYTIME): $SITE" fi fi rm timer.txt done
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。