rtorrent configuration

note: everything with a $ sign will need to be replaced with a value

Directory Layout

This is the expected directory layout, they can be whatever but these are assumed from here on

$home/watch
$home/downloads
$home/oldtorrent
$home/rtorrent-session

$home/.rtorrent.rc

Set up rtorrent to watch a directory for new torrent files There is also a bit of extra configuration, whatever...the important part is schedule, directory, ip, portrange and session

ip = $youripaddress
port_range = 6969-6969
session = ~/rtorrent-session
encryption = allow_incoming,try_outgoing,enable_retry
peer_exchange = yes
dht = on
upload_rate = 2048
download_rate = 2048
directory = ~/downloads
use_udp_trackers = yes
schedule = watch_directory,5,5,load_start=$home/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
schedule = tied_directory,5,5,start_tied=

/etc/rc.local

Depending on your distribution this can be in different places, it's a script executed at boot time.

rm -f /home/$user/rtorrent-session/rtorrent.lock
su -c 'screen -d -m -S rtorrent rtorrent' $user

$home/frontfail.bash

This script checks for new torrents and adds it to rtorrent's watchlist

#!/bin/bash

wget -O 9front.torrent http://iso.9front.r0x0r.me/oldtorrent/latest.torrent
torsum=$(sha1sum 9front.torrent |sed 's, .*,,g')
tor2sum=$(sha1sum watch/9front.torrent |sed 's, .*,,g')
if [[ $torsum != $tor2sum ]]; then
  mv watch/9front.torrent downloads/oldtorrent/9front-$(date +%s |tr -d '\n').torrent
  rm watch/9front.torrent
  cp 9front.torrent watch/
  cp 9front.torrent downloads/oldtorrent/latest.torrent
fi
rm 9front.torrent

Make sure to +x it

And finally a crontab entry to execute this script every hour

0 * * * * /home/$user/frontfail.bash