Wednesday, March 11, 2009

HowTo: Determine the fastest CVSup mirror on FreeBSD

fastest_cvsup is a Perl script to find fastest CVSup server. Amongst it's feature it:
  • uses socket connections not just 'pings'
  • takes notice of server responses
  • connects to servers in countries specified on the command line - or - connects to the 'local' servers defined in the script - or - connects to ALL the servers in ALL the countries
  • returns either fastest server or top 3 (useful for scripts)
  • returns exit codes (useful for scripts)
  • can re-write itself to update the CVSup server list, obtained from the online FreeBSD Handbook
  • can easily add other CVSup servers (NetBSD/OpenBSD...etc)
Here's how to identify the fastest CVSup mirror:
  1. % su
  2. # cd /usr/ports/sysutils/fastest_cvsup
  3. # make install clean
  4. # rehash
  5. # exit
  6. % fastest_cvsup -Q -r -c all
We've started by becoming the superuser, proceeded by installing the port and finally ran it. After running the last command, the application will prompt the fastest mirror.

Change your /etc/make.conf or supfiles with the new mirror. In alternative pass the determined mirror at the command line when running csup.

For more options run:
  • % fastest_cvsup -h
  • % man fastest_cvsup
Some further examples of the script's usage:
  • times the FreeBSD CVSup servers in the United Kingdom, France and Germany:
% fastest_cvsup -c uk,fr,de
  • times the OpenBSD and NetBSD CVSup servers:
% fastest_cvsup -c openbsd,netbsd
  • shell script, finds the fastest UK FreeBSD CVSup server, then runs csup using that server:
#!/bin/sh
if SERVER=`fastest_cvsup -q -c uk`; then
csup -h $SERVER /usr/share/examples/cvsup/standard-supfile
fi
The project's website can be found at http://fastest-cvsup.sourceforge.net/.

No comments: