move all torrent configuration into config.sh
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 27 Aug 2011 15:14:23 +0000 (15:14 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 27 Aug 2011 15:36:52 +0000 (15:36 +0000)
torrent/README
torrent/config.sh [new file with mode: 0755]
torrent/mktorrent.sh
torrent/rtorrent-dump.pl
torrent/start-seeder.sh
torrent/start-tracker.sh

index c6f067f..bd78566 100644 (file)
@@ -9,18 +9,19 @@ Torrent protocol in 2011 is best documented at:
 
 http://wiki.theory.org/BitTorrentSpecification
 
-debian-install.sh provides additional depenencies from debian package for this feature.
+debian-install.sh provides additional depenencies from debian package for this feature.
 
+config.sh - contains all configuration for single IP instance
 
 Usage example:
 
-dpavlin@narada:/srv/cloudstore$ ./torrent/start-tracker.sh
+dpavlin@narada:/srv/cloudstore/torrent$ ./start-tracker.sh 10.60.0.244
 
-dpavlin@narada:/srv/cloudstore$ ./torrent/start-seeder.sh
+dpavlin@narada:/srv/cloudstore/torrent$ ./start-seeder.sh
 
 dpavlin@narada:/srv/cloudstore$ ./torrent/mktorrent.sh md5/ce53d9b33eb1c8cf609cd8c22fd39202
 
 
-c) cleanup all torrents
+c) cleanup all seeding torrents
 
-find send -type l -exec rm -v {} \;
+dpavlin@narada:/srv/cloudstore$ rm -v var/torrent/watch/*
diff --git a/torrent/config.sh b/torrent/config.sh
new file mode 100755 (executable)
index 0000000..b7e297c
--- /dev/null
@@ -0,0 +1,6 @@
+ip_seed=10.60.0.240
+srv=/srv/cloudstore
+var=$srv/var/torrent
+test -d $var || mkdir -pv $var/session $var/watch
+
+ip_tracker=10.60.0.240
index f0d1bb1..e6e6a59 100755 (executable)
@@ -10,9 +10,5 @@ mktorrent --announce http://10.60.0.240:6969/announce --announce http://10.60.0.
 fi
 
 # start seeding
-md5=`basename $1`
-cd send
-ln -sfv ../$1 .
-cd watch
-ln -sfv ../../$1.torrent .
+ln -sfv ../../../$1.torrent var/torrent/watch/
 
index 79eb1f3..bb12855 100755 (executable)
@@ -5,7 +5,7 @@ use strict;
 use RTPG;
 use Data::Dump qw(dump);
 
-my $h = new RTPG(url=>'/tmp/rtorrent.socket');
+my $h = new RTPG(url=>'/srv/cloudstore/var/torrent/socket');
 
 # arrayref and error (standard version)
 my ($tlist, $error)=$h->torrents_list;
index 5585149..4aecce6 100755 (executable)
@@ -1,15 +1,16 @@
 #!/bin/sh -xe
+. ./config.sh
 
-ip=$1
-test -z "$ip" && ip=10.60.0.240
-
-rtorrent -O directory=./send/ \
--O schedule=watch_directory,5,5,load_start=./send/watch/*.torrent \
+rtorrent -O directory=$srv/md5 \
+-O session=$var/session \
+-O schedule=watch_directory,5,5,load_start=$var/watch/*.torrent \
 -O schedule=tied_directory,5,5,start_tied= \
 -O schedule=untied_directory,5,5,close_untied= \
--O scgi_local=/tmp/rtorrent.socket \
--O download_rate=15 \
--O upload_rate=15 \
--O bind=$ip \
+-O scgi_local=$var/socket \
+-O bind=$ip_seed -O port_range=6890-6999 \
+-O dht=auto -O dht_port=6881 \
 -O peer_exchange=yes \
+-O download_rate=15 -O upload_rate=15
+
+# last line for debug, comment out but leave enty line before this comment!
 
index e29e1d4..d0c8a81 100755 (executable)
@@ -1,7 +1,8 @@
-#!/bin/sh -x
+#!/bin/sh -ex
+. ./config.sh
 
 ip=$1
-test -z "$ip" && ip=10.60.0.240
+test -z "$ip" && ip=$ip_tracker
 
-./bin/opentracker -i $ip -p 6969 -s 9696
+$srv/bin/opentracker -i $ip -p 6969 -s 9696