FreeBSD Ports, a treasure trove of useful tools
Tags: Perl, servers
I’ve been configuring one of my machines as a FreeBSD 6.1 server in my spare picoseconds, to serve as a fileserver, rsync server, public mirror, backup server, transparent squid proxy, coffee maker and whatever else I can make it do.
In order to do this, I needed to add a bunch of packages and tweak quite a few hundred things in various places on the system (sysctl, make.conf, loader.conf, add missing tweaks and options to the kernel config) and so on.
I rebuild kernels nightly and keep ports up to date with cvsup. I rarely find time or a need to run portupdate or buildworld, but I know I should, so I found this useful article which describes how to stay current with all of these pieces (and there are a LOT of them).
Buried in the comments, was a pointer to ‘sysutils/fastest_cvsup‘, which is probably the BSD ports equivalent of Debian’s netselect-apt tool. fastest_cvsup is described as follows:
Perl script to find fastest CVSup server: * 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) WWW: http://fastest-cvsup.sourceforge.net/
Running it was as simple as executing it with the right country in mind (or you can pass it ‘-c all’ and test all of them):
# fastest_cvsup -c us >> Querying servers in countries: us --> Connecting to cvsup.us.freebsd.org [198.104.69.57]... - server replied: ! Access limit exceeded; try again later - time taken: 146.89 ms --> Connecting to cvsup2.us.freebsd.org [130.94.149.166]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 42.03 ms --> Connecting to cvsup3.us.freebsd.org [128.31.0.28]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 35.09 ms --> Connecting to cvsup4.us.freebsd.org [204.152.184.73]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 114.04 ms --> Connecting to cvsup5.us.freebsd.org [64.157.15.40]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 74.04 ms --> Connecting to cvsup6.us.freebsd.org [69.31.98.210]... * error: connect: Invalid argument --> Connecting to cvsup7.us.freebsd.org [129.250.31.140]... - server replied: OK 17 0 SNAP_16_1g CVSup server ready - time taken: 104.05 ms --> Connecting to cvsup8.us.freebsd.org [216.165.129.134]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 57.24 ms --> Connecting to cvsup9.us.freebsd.org [128.205.32.21]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 53.00 ms --> Connecting to cvsup10.us.freebsd.org [128.205.32.10]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 52.02 ms --> Connecting to cvsup11.us.freebsd.org [63.87.62.77]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 33.05 ms --> Connecting to cvsup12.us.freebsd.org [128.46.156.46]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 49.02 ms --> Connecting to cvsup13.us.freebsd.org [216.144.193.227]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 50.02 ms --> Connecting to cvsup14.us.freebsd.org [64.78.150.180]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 156.16 ms --> Connecting to cvsup15.us.freebsd.org [131.193.178.106]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 50.05 ms --> Connecting to cvsup16.us.freebsd.org [128.143.108.35]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 65.03 ms --> Connecting to cvsup17.us.freebsd.org [65.212.71.21]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 43.05 ms --> Connecting to cvsup18.us.freebsd.org [128.205.32.37]... - server replied: OK 17 0 SNAP_16_1h CVSup server ready - time taken: 56.02 ms >> Speed Daemons: - 1st: cvsup11.us.freebsd.org 33.05 ms - 2st: cvsup3.us.freebsd.org 35.09 ms - 3st: cvsup2.us.freebsd.org 42.03 ms
So now I can stick cvsup11.us.freebsd.org in my .sup files and hopefully gain the fastest connection to those servers for updates.