create torrents in new /host/s?/torrent layout
authorDobrica Pavlinusic <dpavlin@rsync1.maxxo.com>
Sat, 7 Jan 2012 15:30:21 +0000 (16:30 +0100)
committerDobrica Pavlinusic <dpavlin@rsync1.maxxo.com>
Sat, 7 Jan 2012 15:30:21 +0000 (16:30 +0100)
torrent/mktorrent.sh

index e6e6a59..bb072f8 100755 (executable)
@@ -1,14 +1,28 @@
-#!/bin/sh -xe
+#!/bin/sh -e
 
-chmod 444 $1
+cd /rsync1/s1
 
-if [ ! -e $1.torrent ] ; then
+
+test -d torrent/md5 || mkdir torrent/md5
+
+torrent="torrent/md5/$1.torrent"
+file="md5/$1"
+
+if [ ! -f $file ] ; then
+       echo "usage: $0 md5"
+       exit 1
+fi
+
+if [ ! -e $torrent ] ; then
+
+eval export `grep s1 /var/lib/extrausers/group | cut -d: -f4`
 
 # -p prevents sharing between clients
-mktorrent --announce http://10.60.0.240:6969/announce --announce http://10.60.0.244:6969/announce --no-date --verbose --output $1.torrent $1
+mktorrent --announce http://$tracker_ip:$tracker_port/announce --no-date --verbose --output $torrent $file
 
 fi
 
+test -d torrent/seed || mkdir torrent/seed
 # start seeding
-ln -sfv ../../../$1.torrent var/torrent/watch/
+ln -sfv `pwd`/$torrent torrent/seed/