Periodic email about security notifications
Leo Bicknell
bicknell at ufp.org
Mon May 5 11:14:21 PDT 2003
In a message written on Mon, May 05, 2003 at 10:54:47AM -0500, Kirk Strauser wrote:
> There's nothing at all wrong with that. My goal, though was to
> automatically add that functionality to *every* program that would
> ordinarily connect to ftp.freebsd.org. With the exception of changing some
> default values, no programs would have to be modified to get the new
> rotating-mirror capability.
I'm sure there is a better way to do this, but I've used this script
before:
#!/bin/sh
(
for host in ftp1 ftp2 ftp3 ftp4 ftp5 ftp6 ftp7 ftp8 ftp9
do
MS=`ping -q -c 2 $host.freebsd.org | tail -1 | sed -e 's,.*= [0-9.]*/,,' -e 's,/.*,,'`
echo $MS | grep "0 packets received" > /dev/null 2>&1
if [ $? = 0 ]
then
echo "9999 $host.freebsd.org"
else
echo "$MS $host.freebsd.org"
fi
done
) | sort -n | head -1 | sed -e 's/.* //'
If say, ftpmirrors.freebsd.org returned CNAME's for all active
mirrors you could grab that with host or dig, pipe it into this
code, and output the "closest" (by network time anyway) server.
Make a file /etc/best_freebsd_mirror and make the ports run this
script if it isn't set, and otherwise run it once a week in cron
or something to catch updates.
Anyway, method aside, making it so the user doesn't have to do
anything, yet the load gets distributed and a "good", if not "the
best" server is picked would be a good thing.
--
Leo Bicknell - bicknell at ufp.org - CCIE 3440
PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - tmbg-list-request at tmbg.org, www.tmbg.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20030505/789b628f/attachment.bin
More information about the freebsd-hackers
mailing list