|libTorrent at Wikia [
rTorrent [ ]
Common Tasks in rTorrent for Dummies
This page is for showing examples on how to use the many options in rTorrent. Only real examples you can apply immediately, no theory at all.
Saving torrent state and resume data between sessions
# Point to a directory where rTorrent will save the torrent files. You # may also use relative paths if you want different session # directories depending on where you execute rtorrent. # # session = ./session session = ~/Download/session
Watch a directory for torrents
# Watch a directory for new torrents, restart torrents that have been # copied back and stop those that have been deleted. schedule = watch_directory,10,10,load_start=~/Download/watch/*.torrent schedule = tied_directory,10,10,start_tied= schedule = untied_directory,10,10,close_untied= # Watch another directory with a different destination. (0.7.7+) schedule = watch_directory_2,10,10,"load_start=~/Download/watch_stuff/*.torrent,d.set_directory=~/Download/stuff/"
# Create symlinks in the watch directory with a suffix indicating the # download state. on_start = link1,"create_link=tied,,.started" on_stop = link1,"delete_link=tied,,.started" on_finished = link1,"create_link=tied,,.finished" on_erase = link1,"delete_link=tied,,.finished" # Create symlinks in the same directory as the download. on_start = link2,"create_link=base_path,,.started" on_stop = link2,"delete_link=base_path,,.started" on_finished = link2,"create_link=base_path,,.finished" on_erase = link2,"delete_link=base_path,,.finished" # Create a symlink in another directory without a suffix. # You need to quote the command in this case. on_finished = link3,"create_link=base_filename,/files,"
Move completed torrents
# When the torrent finishes, it executes "mv -n <base_path> ~/Download/" # and then sets the destination directory to "~/Download/". (0.7.7+) on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,~/Download/ ;d.set_directory=~/Download/" # On MacOSX and *BSD. on_finished = move_complete,"execute=mv,-n,$d.get_base_path=,~/Download/ ;d.set_directory=~/Download/"
Move completed torrents to different directory depending on watch directory
# Each watch directory adds torrents with the final destination stored # in the "custom1" string of the download. You can check this string with # ctrl-X then "print=$d.get_custom1=" in the client. schedule = watch_directory_1,10,10,"load_start=~/Download/watch_stuff1/*.torrent,d.set_custom1=~/Download/stuff1/" schedule = watch_directory_2,10,10,"load_start=~/Download/watch_stuff2/*.torrent,d.set_custom1=~/Download/stuff2/" # On completion, move the torrent to the directory from custom1. on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,$d.get_custom1= ;d.set_directory=$d.get_custom1=" # the above line for Mac OS X and *BSD. on_finished = move_complete,"execute=mv,-n,$d.get_base_path=,$d.get_custom1= ;d.set_directory=$d.get_custom1="
Stop torrents after reaching a specified upload ratio
# stop_on_ratio = min_ratio,min_upload,max_ratio # # Example: schedule = ratio,60,60,"stop_on_ratio=200,50M,300"
The "stop_on_ratio" command can be scheduled to stop torrents that have reached a specified upload ratio. Only the first parameter is required, the last two may be used to ensure smaller torrents are seeded more. The above example will stop a torrent once it has uploaded 200% of the torrent size, unless less than 50MB has been uploaded and the ratio is below 300%.
Use shift-I to make a torrent ignore this and other commands.
Scheduling download rate
schedule = throttle_1,01:00:00,24:00:00,download_rate=0 schedule = throttle_2,05:00:00,24:00:00,download_rate=25
Every day "throttle_1" gets triggered at 01:00 and sets the download rate to unlimited, while "throttle_2" sets it to 25kb at 05:00. Using this the client may be made to perform a somewhat crude form of bandwidth scheduling.
Using a different configuration file
$ rtorrent -n -o import=~/foo.rc
The '-n' switch tells rtorrent not to load the default resource file, while the import option loads '~/foo.rc'.
Adding fast resume data to torrent files
When you are the first seeder for a torrent, rTorrent will normally have to hash-check all files even if you just created the torrent file from them and thus know that they are correct. To eliminate this step, the following Perl script by Josef Drexler can add rTorrent's fast resume data to the torrent file: <a href="http://libtorrent.rakshasa.no/downloads/rtorrent_fast_resume.pl">http://libtorrent.rakshasa.no/downloads/rtorrent_fast_resume.pl</a>.
$ rtorrent_fast_resume.pl [base-directory] < original.torrent > modified.torrent
Then you can distribute the original torrent file and load the modified file into rTorrent and start seeding without needing a hash check. The base directory specifies where the files in the torrent are located, equivalent to the "directory" option in rtorrent.rc. If not specified, the files are assumed to be in the current directory.
Note that this script requires the Convert::Bencode module from CPAN, if this module is not available on your system you will need to install it first:
$ perl -MCPAN -e 'install Convert::Bencode'
Starting rTorrent on System Startup
Step 1: Assuming a Debian-based distribution, create /etc/init.d/rtorrent with <a href="http://libtorrent.rakshasa.no/attachment/wiki/RTorrentCommonTasks/rtorrentInit.sh?format=raw">http://libtorrent.rakshasa.no/attachment/wiki/RTorrentCommonTasks/rtorrentInit.sh?format=raw</a>, editing the Configuration to suit your needs.
Step 2: Make sure it has appropriate permissions:
# ls -l /etc/init.d/rtorrent -rwxr-xr-x 1 root root 3000 2007-03-06 22:40 /etc/init.d/rtorrent
Step 3: Update your init system (as sudo/su/root):
# update-rc.d rtorrent defaults