sobt.pl - Synchronizes current OpenBSD torrents from http://OpenBSD.somedomain.net/
When new files are released by the OpenBSD team, new torrents are generated. Keeping your local files synchronized with what is out there can be time consuming. This script is here to help. It will read the RSS feeds available from http://OpenBSD.somedomain.net, make sure you have the newest torrent for each directory you want, and get rid of any old versions.
This script does not do anything with the torrents other than sync them.
If you want to actually download the files in the torrent you will need
another program in addition to this script. I have tested it with
btlaunchmany from the official BitTorrent client, but any BitTorrent client
that can watch a directory for torrents should work.
A limitation of this script is that it will not clean up torrents that you no longer want. For example, when the latest version changes from 3.7 to 3.8, it will download the new 3.8 torrents, but it will no longer update the 3.7 torrents or delete them. The same is true if you remove an RSS feed from the list of URLs. If you want them deleted, you will have to do it manually.
This script should run on any version of perl that supports the required modules. The only required modules that are not part of the base perl install are XML::RAI and LWP::Simple. It has been successfully tested on OpenBSD 3.7, OS X 10.2 and Windows 2000 with Activeperl 5.8.7 build 813.
This script is designed to be run regularly from cron (or the Windows task scheduler). It should not need to run more than every four hours because that is as often as the RSS feeds are updated.
The file can be saved anywhere, for instance, $HOME/bin. It runs under taint mode normally, so if it is running in Windows, it will need to be run with perl -T sobt.pl, or remove the -T from the first line in the script.
It can be put in cron like this:
MIN */4 * * * <path/to/>sobt.pl > /dev/null Where MIN is a number between 6 and 54 to even the load on the server.
The script outputs newly downloaded and deleted files on STDERR so cron should send you an e-mail whenever files are updated.
Changing the settings that control the operation of this script can be done by changing variables directly in the script. There are only a few settings available, and most of them can be left at their default settings.
A valid url for the array can either be one of the special mod_rewrite *.rss feeds, or one of the normal rss.php feeds.
Replace 'zaurus' in the url with a different architecture.
Replace 'i386' in the url with a different architecture and 'latest+release' with a different version.
Replace 'amd64' in the url with a different architecture and 'snapshots' with a different version.
Andrew Fresh <andrew@mad-techies.org>
Copyright © 2005 Andrew Fresh. All rights reserved. Licensed under a two clause BSD style license, the full text of which can be found in the source of the main script.
$Id: sobt.pl,v 1.31 2005/06/21 06:09:07 andrewfresh Exp $