Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jan 1996 01:23:28 -0800
From:      "Jordan K. Hubbard" <jkh@time.cdrom.com>
To:        David Dawes <dawes@rf900.physics.usyd.edu.au>
Cc:        hackers@freebsd.org
Subject:   Re: Mirror site maintainers! Please check... 
Message-ID:  <4648.820661008@time.cdrom.com>
In-Reply-To: Your message of "Wed, 03 Jan 1996 19:27:00 %2B1100." <199601030827.TAA07999@rf900.physics.usyd.edu.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
[Cc'd to -hackers as I attempt to explain the method to my madness herein]

> The au addresses point to the right place, but the path for
> ftp2.au.freebsd.org isn't right.  It is /BSD/FreeBSD (or /FreeBSD).

Urk.  I don't suppose I could convince you to put in a pub/FreeBSD
symlink?  I'm not trying to be an archive fascist here, I'm really
not, I'm just trying to make things as orthogonal as possible.

In particular, what I'd really like to be able to do at some
point is probably best demonstrated by the following shell script,
let's call it `hosts':

---- cut here ----
#!/bin/sh

usage()
{
	echo "Usage: $0 [-q] <domain>|top"
	exit 1
}

if [ $# -lt 1 ]; then
	usage
fi

if [ "$1" = "-q" ]; then
	quiet=YES
	shift
else
	quiet=NO
fi

if [ $# -lt 1 ]; then
	usage
elif [ $# -lt 2 ]; then
	target=ftp
else
	target=$2
fi

if [ "$1" != "top" ]; then
	domain=$1.freebsd.org
else
	domain=freebsd.org
fi

if [ "$quiet" != "YES" ]; then
	echo Looking for $target servers in the $domain domain.
fi

# First look for the `base' server.  If it doesn't exist, it's pretty much
# assured that there won't be any others.
if host $target.$domain > /dev/null 2>&1 ; then
	echo $target.$domain
	next=2
	while [ $next -ne 0 ]; do
		if host $target$next.$domain > /dev/null 2>&1 ; then
			echo $target$next.$domain
			next=`expr $next + 1`
		else
			success=NO
			next=0
		fi
	done
fi
exit 0

---- cut here ----

Now we can do this to find all the FTP servers in Japan:

jkh@time-> ./hosts jp ftp
Looking for ftp servers in the jp.freebsd.org domain.
ftp.jp.freebsd.org
ftp2.jp.freebsd.org
ftp3.jp.freebsd.org
ftp4.jp.freebsd.org
ftp5.jp.freebsd.org
ftp6.jp.freebsd.org

Or all the WWW servers in Brazil:

jkh@time-> ./hosts br www
Looking for www servers in the br.freebsd.org domain.
www.br.freebsd.org

But where it really comes into its own (and why I need consistent
naming on the mirrors) is in something like this:

	target=".. some file .."
	domain=".. some domain, perhaps chosen from a menu .. "

	success=NO
	while [ "$success" = "NO ]; do
		for host in `./hosts -q $domain`; do
			if ncftp ftp://$host/pub/FreeBSD/$target; then
				success=YES ;
				break
			fi
		done
	done

Voila - one auto-fetcher that automatically tries all the mirrors
in a given domain.  You could even change it to:

		for host in `./hosts -q $domain` `./hosts -q top`; do

To try all the regional ones first, followed by the main archive
U.S. sites.

Anyway, I'm sure you get the basic idea!

> I also notice that you don't have maintainer addresses for the sites
> in the *.freebsd.org domains.  Is that intentional?

Yeah, basically I'm trying to get things to the point where we can
shift the load around at will as major sites change management or
otherwise get overtaken by others with better connectivity.  To get to
that point, we need to start thinking of `ftp2.au.freebsd.org' less as
a machine and more as a carefully managed `slot' in Australia's ftp
coverage.

						Jordan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4648.820661008>