Subject: Very rough MASTER SITE sorter
To: None <tech-pkg@netbsd.org>
From: David Maxwell <david@fundy.ca>
List: tech-pkg
Date: 06/19/1999 18:01:53
This could be a lot cleaner in a number of ways,
a) not use a /tmp file, perhaps
b) rewrite in sh instead of csh?

Basically, it's a csh script that takes a variable argument that
looks like a MASTER_SITES list, and pings each one and sorts the
list. (sorting by Max RTT)

Right now, it sends just 1 packet. You could raise that and it 
might be a bit more accurate, though for true accuracy, it
really ought to learn about packet loss, and maybe even try a
file transfer.

I tend to believe ping is the simplest fairly accurate way to
estimate which site is best.

Feel free to use this as you (anyone) see fit.


#!/bin/csh

set atest="ftp://ftp.cdrom.com/pub/tex/ctan/ ftp://wuarchive.wustl.edu/packages/TeX/ ftp://ftp.funet.fi/pub/TeX
/CTAN/  ftp://ftp.tex.ac.uk/public/ctan/tex-archive/ ftp://ftp.dante.de/tex-archive/"

foreach i ( $atest )
        set j=`echo $i | sed 's/^.*\/\///;s/\([^\/]*\).*/\1/'`
        ping -c1 -q $j | tail -1 | sed 's/^.*=//;s/^.*\/.*\/\(.*\)\/.*$/\1/;s/$/ '$j'/' >> /tmp/srt$$
end     
   
grep -v 'packet loss' /tmp/srt$$ | sort -n && rm /tmp/srt$$


-- 
David Maxwell, david@vex.net|david@maxwell.net -->
(About an Amiga rendering landscapes) It's not thinking, it's being artistic!
					      - Jamie Woods