sheep/logs/0000755000175100001440000000000010465021305011751 5ustar deanuserssheep/README0000444000175100001440000000133010567262316011674 0ustar deanusershi... here are some scripts to help run a sheep seeder using rtorrent. rss-thinger is a crude script to grab the rss feed and maintain a cache of torrents... and deletes the old data as it expires. you probably need to customize a few of the settings in this script. i use the crontab below... you should modify at least the "sleep 15" on the rss line... pick some arbitrary number between 0 and 180. -dean MAILTO=foo@bar PATH=/home/dean/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/games HOME=/home/dean SHEEP=/home/dean/sheep @reboot sleep 120; screen -d -m -c $HOME/sheep/.screenrc-reboot */5 * * * * sleep 43; (date; $HOME/sheep/rss-thinger) >>$HOME/sheep/rss-thinger.out 2>&1 sheep/rss-thinger0000744000175100001440000000700210504711664013205 0ustar deanusers#!/usr/bin/perl -w # this is a complete hack of a script for maintaining the torrents and # downloaded data on a sheep bt seeder. if the xml changes this script # will probably break. # Copyright (C) 2006 dean gaudet # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ## these settings will need configuration # number of torrents to keep my $nr_keep = 10; my $dir = "/home/dean/sheep/torrents"; #my $dir = "/home/dean/sheep/test"; my $rss_url = "http://sheepserver.net/v2d6/gen/rss.xml"; my $torrent_base_url = "http://v2d6\.sheepserver\.net/gen/torrents/"; my $torrent_download_url = "http://sheepserver.net/v2d6/gen/torrents/"; # the rest shouldn't need configuration use strict; use Fcntl ':flock'; use File::Temp qw/tempfile/; use LWP::UserAgent; my $exit_code = 0; # die in 4 minutes no matter what alarm(4*60); chdir($dir) or die "unable to chdir($dir): $!\n"; open(LOCKFILE, ">>.rss-thinger.lock") or die "unable to open .rss-thinger.lock: $!\n"; flock(LOCKFILE, LOCK_EX|LOCK_NB) or die "unable to lock .rss-thinger.lock: $!\n"; # grab the RSS and scrape the torrent links my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $rss_url); my $res = $ua->request($req); $res->is_success or die "error fetching $rss_url: ".$res->status_line."\n"; my %avail; foreach my $line (split('\n', $res->content)) { if ($line =~ m#\$torrent_base_url(\d+)\.torrent\#o) { $avail{$1} = 1; } } # download the most recent ones if we need to my $nr_download = ($nr_keep > scalar(keys %avail)) ? scalar(keys %avail) : $nr_keep; foreach my $download ((sort { $b <=> $a } keys %avail)[0..$nr_download-1]) { next if -f "$download.torrent"; $req = HTTP::Request->new(GET => "$torrent_download_url$download.torrent"); $res = $ua->request($req); unless ($res->is_success) { warn "unable to fetch $torrent_download_url$download.torrent: ".$res->status_line."\n"; $exit_code = 1; } else { my ($tmp_fh, $tmp_filename) = tempfile("tmp.XXXXXX", DIR => "."); unless (defined($tmp_fh) and $tmp_fh->print($res->content) and $tmp_fh->close) { warn "error writing temp file: $!\n"; $exit_code = 1; unlink($tmp_filename) if defined($tmp_filename); } else { unless (rename($tmp_filename, "$download.torrent")) { warn "unable to rename($tmp_filename, $download.torrent): $!\n"; $exit_code = 1; unlink($tmp_filename); } } } } # now discover any old torrents/downloaded files we need to delete opendir(DIR, ".") or die "unable to opendir(.): $!\n"; my @to_delete = sort { $a <=> $b } map { /^(\d+)\.torrent$/ } grep { /^(\d+)\.torrent$/ } readdir(DIR); close(DIR); exit $exit_code if ($nr_keep > scalar(@to_delete)); splice(@to_delete, -$nr_keep); foreach my $delete (@to_delete) { my @args = ("rm", "-rf", "$delete.torrent", "$delete"); #print "@args\n"; unless (system(@args) == 0) { warn "system(@args) failed: $?\n"; $exit_code = 1; } } exit $exit_code; sheep/rtorrent.rc0000644000175100001440000000476010514625412013225 0ustar deanusers# Maximum and minimum number of peers to connect to per torrent. min_peers = 10 max_peers = 500 min_peers_seed = 10 max_peers_seed = 500 # Maximum number of simultanious uploads per torrent. max_uploads = 500 # Global upload and download rate in KiB. "0" for unlimited. download_rate = 7000 upload_rate = 50000 working_directory = /home/dean/sheep/torrents # Default directory to save the downloaded torrents. #directory = ./ # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? session = ../run/sessions # Watch a directory for new torrents, and stop those that have been # deleted. schedule = watch_directory,5,5,load_start=./*.torrent schedule = untied_directory,5,5,stop_untied= # The ip address reported to the tracker. #ip = clients.sheepserver.net # The ip address the listening socket and outgoing connections is # bound to. #bind = clients.sheepserver.net # Port range to use for listening. port_range = 31415-31415 # Start opening ports at a random position within the port range. port_random = no # Check hash for finished torrents. Might be usefull until the bug is # fixed that causes lack of diskspace not to be properly reported. check_hash = yes # Set whetever the client should try to connect to UDP trackers. use_udp_trackers = no # Alternative calls to bind and ip that should handle dynamic ip's. #schedule = ip_tick,0,1800,ip=rakshasa #schedule = bind_tick,0,1800,bind=rakshasa # # Do not modify the following parameters unless you know what you're doing. # # Hash read-ahead controls how many MB to request the kernel to read # ahead. If the value is too low the disk may not be fully utilized, # while if too high the kernel might not be able to keep the read # pages in memory thus end up trashing. #hash_read_ahead = 10 hash_read_ahead = 2 # Interval between attempts to check the hash, in milliseconds. #hash_interval = 100 # Number of attempts to check the hash while using the mincore status, # before forcing. Overworked systems might need lower values to get a # decent hash checking rate. #hash_max_tries = 10 hash_max_tries = 0 # Max number of files to keep open simultaniously. max_open_files = 2000 # Number of sockets to simultaneously keep open. max_open_sockets = 6000 # Example of scheduling commands: Switch between two ip's every 5 # seconds. #schedule = "ip_tick1,5,10,ip=torretta" #schedule = "ip_tick2,10,10,ip=lampedusa" # Remove a scheduled event. #schedule_remove = "ip_tick1" sheep/run/0000755000175100001440000000000010472730130011612 5ustar deanuserssheep/torrents/0000755000175100001440000000000010567257506012706 5ustar deanusers