自动查找最快的镜像站点(ubuntu)--博客之家 - Sent Using Google Toolbar

0 views
Skip to first unread message

deadivan

unread,
May 31, 2007, 11:49:16 PM5/31/07
to mdky
自动查找最快的镜像站点(ubuntu)--博客之家

自动查找最快的镜像站点(ubuntu)

Linux /linuxman 发表于2006-12-15, 15:34
找到了一个脚本,可以自动搜索ubuntu的最快镜像站点,用了一下还是很有用的,抄录在这里:

#!/bin/sh

if [ $# != 1 -a "$1" != "dapper" -a "$1" != "edgy" ] ; then
  echo "$0 (dapper|edgy)"
  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://apt.nc.hcc.edu.tw/pub/ubuntu/ \
http://os.nchc.org.tw/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

echo "fatest mirror is $SITE, enjoy!"


原始出处:http://blog.scaner.i.thu.cn/index.php/2006/04/19/ubuntu-get-fast-source-script/

标签: ubuntu
Reply all
Reply to author
Forward
0 new messages