send torrent via rsync and trigger torrent_download
[cloudstore.git] / client / upload-torrent.sh
diff --git a/client/upload-torrent.sh b/client/upload-torrent.sh
new file mode 100755 (executable)
index 0000000..63c8f4f
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh -xe
+
+# name inside torrent must be md5sum to provide distributed upload
+md5=`md5sum $1 | cut -d' ' -f1`
+ln -s $1 $md5
+mktorrent -a http://213.186.16.27:6502/announce --no-date --name=$md5 --output=$1.torrent --verbose $md5
+
+USER=u2003
+IP=10.13.37.101
+RSYNC_PASSWORD=password rsync $1.torrent rsync://$USER@$IP:6501/$USER/
+
+echo "~$USER/$1.torrent" | gearman -h 10.13.37.101 -f rsync1_s1_torrent_download -n
+
+ctorrent $1.torrent