NSLU2-Linux
view · edit · print · history

OpenSlug.InstallCtorrent History

Hide minor edits - Show changes to markup

December 06, 2007, at 03:42 PM by Miikka -- Fix script to accept torrents with spaces - requires \"quotes\"
Changed line 54 from:

mv $TORRENTFILE $WORKDIR

to:

mv "$TORRENTFILE" $WORKDIR

Changed line 58 from:

ctorrent -C $CACHE_SIZE -B $MAX_KB -M $MAX_CON -e $SEED_TIME $TORRENTFILE

to:

ctorrent -C $CACHE_SIZE -B $MAX_KB -M $MAX_CON -e $SEED_TIME "$TORRENTFILE"

January 14, 2006, at 04:44 AM by Stein -- ctorrent crash when fetching big files -> fixed when adding swap
Added lines 64-68:

My ctorrent was getting killed because it was hogging all the memory. Solution: add swap. http://www.nslu2-linux.org/wiki/HowTo/AddAdditionalSwapSpace
--
-Stein

November 16, 2005, at 08:43 AM by Eiffel -- added the MAX_CON variable to prevent killing your router due too many open connections
Added line 47:

MAX_CON="200" # Limit maximum connections to 200

Changed line 58 from:

ctorrent -C $CACHE_SIZE -B $MAX_KB -e $SEED_TIME $TORRENTFILE

to:

ctorrent -C $CACHE_SIZE -B $MAX_KB -M $MAX_CON -e $SEED_TIME $TORRENTFILE

August 23, 2005, at 10:19 PM by tman --
Changed lines 3-8 from:

This is rather easy when you know how:

  1. ipkg install ctorrent
  2. If you are behind a firewall, you need to open at least port 2706 TCP incoming. CTorrent starts trying port 2706, and if it fails it starts counting downwards towards 2106 TCP.

You might want to install screen (ipkg install screen), so that you can run ctorrent in a screen session: \\

to:

Using ipkg to install CTorrent:

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

 
ipkg install ctorrent

(:tableend:)

If you are behind a firewall, you need to open at least port 2706 TCP incoming. CTorrent starts trying port 2706, and if it fails it starts counting downwards towards 2106 TCP.

You might want to install screen (ipkg install screen), so that you can run ctorrent in a screen session:

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

 [=
Changed lines 20-22 from:
to:

=] (:tableend:)

August 23, 2005, at 10:17 PM by tman --
Changed lines 1-2 from:

How to install ctorrent on OpenSlug:

to:

How to install CTorrent on OpenSlug:

Changed lines 5-7 from:
  1. $ ipkg install ctorrent
  2. If you are behind a firewall, you need to open *atleast* port 2706 TCP incoming. ctorrent starts trying port 2706, and if it fails it starts counting downwards towards 2106 TCP.
to:
  1. ipkg install ctorrent
  2. If you are behind a firewall, you need to open at least port 2706 TCP incoming. CTorrent starts trying port 2706, and if it fails it starts counting downwards towards 2106 TCP.
Changed lines 9-13 from:

screen -dmS torrent ctorrent <torrentfile>

NOTE: ctorrent uses quite a bit of memory (Currently, it's using about 58% on my slug), so you might run into problems if you run a lot of services on your slug. NOTE: The memory usage is adjustable with -C. The default cache size is 16MB, which explains the high mem usage. In the script below, it's changed to 4MB which is no problem for most slugs. Feel free to change it ;-)

to:

screen -dmS torrent ctorrent <torrentfile>

CTorrent uses quite a bit of memory (Currently, it's using about 58% on my slug), so you might run into problems if you run a lot of services on your slug.

The memory usage is adjustable with -C. The default cache size is 16MB, which explains the high mem usage. In the script below, it's changed to 4MB which is no problem for most slugs. Feel free to change it ;-)

Changed lines 16-17 from:

This script is run as a cron-job every now and then. \\

to:

This script is run as a cron-job every now and then.

Added line 19:
Changed lines 21-47 from:

And, it doesn't handle filenames with spaces/special chars. You'll need mailx and ssmtp for it to be able to send mail

#!/bin/sh
set -x
TORRENTDIR="/path/to/share"
WORKDIR="/path/to/temporary/dir"
FINISHED_DIR="/where/to/put/stuff/when/finished/"
SEED_TIME="1" # Seed for X hours after finishing
MAIL="your@mail.address"
MAX_KB="40" # Limit bandwidth usage to 40KB/s
CACHE_SIZE="4" # Cache size 4MB instead of the default 16MB

cd $TORRENTDIR
[ -e $TORRENTDIR/Working.txt ] && exit
TORRENTFILE=`find . -maxdepth 1 -name "*.torrent" | head -n 1 | cut -d "/" -f 2`
[ "$TORRENTFILE" = "" ] && exit
mv $TORRENTFILE $WORKDIR
cd $WORKDIR
echo|mail -s "Torrent started: $TORRENTFILE" $MAIL
echo $TORRENTFILE > $TORRENTDIR/Working.txt
ctorrent -C $CACHE_SIZE -B $MAX_KB -e $SEED_TIME $TORRENTFILE
mv $WORKDIR/* $FINISHED_DIR/
echo|mail -s "Torrent finished: $TORRENTFILE" $MAIL
rm $TORRENTDIR/Working.txt \\

to:

It doesn't handle filenames with spaces/special chars. You'll need mailx and ssmtp for it to be able to send mail

(:table border=0 width=100% bgcolor=#eeffee:) (:cell:)

 
#!/bin/sh
set -x
TORRENTDIR="/path/to/share"
WORKDIR="/path/to/temporary/dir"
FINISHED_DIR="/where/to/put/stuff/when/finished/"
SEED_TIME="1"   # Seed for X hours after finishing
MAIL="your@mail.address"
MAX_KB="40"      # Limit bandwidth usage to 40KB/s
CACHE_SIZE="4"   # Cache size 4MB instead of the default 16MB

cd $TORRENTDIR
[ -e $TORRENTDIR/Working.txt ] && exit
TORRENTFILE=`find . -maxdepth 1 -name "*.torrent" | head -n 1 | cut -d "/" -f 2`
[ "$TORRENTFILE" = "" ] && exit
mv $TORRENTFILE $WORKDIR
cd $WORKDIR
echo | mail -s "Torrent started: $TORRENTFILE" $MAIL
echo $TORRENTFILE > $TORRENTDIR/Working.txt
ctorrent -C $CACHE_SIZE -B $MAX_KB -e $SEED_TIME $TORRENTFILE
mv $WORKDIR/* $FINISHED_DIR/
echo | mail -s "Torrent finished: $TORRENTFILE" $MAIL
rm $TORRENTDIR/Working.txt

(:tableend:)

August 12, 2005, at 12:46 AM by repvik --
Changed lines 12-13 from:
to:

NOTE: The memory usage is adjustable with -C. The default cache size is 16MB, which explains the high mem usage. In the script below, it's changed to 4MB which is no problem for most slugs. Feel free to change it ;-)

August 12, 2005, at 12:34 AM by repvik --
Changed lines 29-31 from:
to:

CACHE_SIZE="4" # Cache size 4MB instead of the default 16MB

Changed line 40 from:

ctorrent -B $MAX_KB -e $SEED_TIME $TORRENTFILE \\

to:

ctorrent -C $CACHE_SIZE -B $MAX_KB -e $SEED_TIME $TORRENTFILE \\

August 11, 2005, at 02:10 AM by repvik -- whoops, fix so not everybody sends me mail when their torrent finishes ;)
Changed line 36 from:

echo|mail -s "Torrent started: $TORRENTFILE" oyvind@repvik.org \\

to:

echo|mail -s "Torrent started: $TORRENTFILE" $MAIL \\

August 11, 2005, at 02:07 AM by repvik --
Deleted line 5:
  1. $ echo 3 > /proc/cpu/alignment (This needs to be done on every boot, otherwise ctorrent won't download anything)
Changed lines 11-41 from:

NOTE: ctorrent uses quite a bit of memory (Currently, it's using about 58% on my slug), so you might run into problems if you run a lot of services on your slug.

to:

NOTE: ctorrent uses quite a bit of memory (Currently, it's using about 58% on my slug), so you might run into problems if you run a lot of services on your slug.

Below is the script I use to automatically download torrents I save on a share: This script is run as a cron-job every now and then.
I start it as a screen session with "*/2 * * * * screen -dmS torrent /path/to/script" It's not advanced, and doesn't check much for errors. Feel free to update it a bit ;-) And, it doesn't handle filenames with spaces/special chars. You'll need mailx and ssmtp for it to be able to send mail

#!/bin/sh
set -x
TORRENTDIR="/path/to/share"
WORKDIR="/path/to/temporary/dir"
FINISHED_DIR="/where/to/put/stuff/when/finished/"
SEED_TIME="1" # Seed for X hours after finishing
MAIL="your@mail.address"
MAX_KB="40" # Limit bandwidth usage to 40KB/s
cd $TORRENTDIR
[ -e $TORRENTDIR/Working.txt ] && exit
TORRENTFILE=`find . -maxdepth 1 -name "*.torrent" | head -n 1 | cut -d "/" -f 2`
[ "$TORRENTFILE" = "" ] && exit
mv $TORRENTFILE $WORKDIR
cd $WORKDIR
echo|mail -s "Torrent started: $TORRENTFILE" oyvind@repvik.org
echo $TORRENTFILE > $TORRENTDIR/Working.txt
ctorrent -B $MAX_KB -e $SEED_TIME $TORRENTFILE
mv $WORKDIR/* $FINISHED_DIR/
echo|mail -s "Torrent finished: $TORRENTFILE" $MAIL
rm $TORRENTDIR/Working.txt \\

August 10, 2005, at 01:55 AM by repvik --
Added lines 1-12:

How to install ctorrent on OpenSlug:

This is rather easy when you know how:

  1. $ ipkg install ctorrent
  2. $ echo 3 > /proc/cpu/alignment (This needs to be done on every boot, otherwise ctorrent won't download anything)
  3. If you are behind a firewall, you need to open *atleast* port 2706 TCP incoming. ctorrent starts trying port 2706, and if it fails it starts counting downwards towards 2106 TCP.

You might want to install screen (ipkg install screen), so that you can run ctorrent in a screen session:
screen -dmS torrent ctorrent <torrentfile>

NOTE: ctorrent uses quite a bit of memory (Currently, it's using about 58% on my slug), so you might run into problems if you run a lot of services on your slug.

view · edit · print · history · Last edited by Miikka.
Based on work by Stein, Eiffel, tman, and repvik.
Originally by repvik.
Page last modified on December 06, 2007, at 03:42 PM