Set Up rTorrent on LSPro

rTorrent is a console-based BitTorrent client with a focus on efficiency. Ths guide describes how to set up rTorrent on the LSPro with screen, and to start/pause/resume a torrent by monitoring a watch directory. I am a new linux user myself so feel free to improve the commands I used.

The procedure was performed with the jtymod5 firmware but should work on stock firmware as well.

Getting the Precompiled Binaries

 * 1) The torrent client: rTorrent v0.77
 * 2) GNU screen: v4.0.0.03

Thanks to khisanth for the binaries.

If you encounter problems with getting a corrupted gzip file through an internet browser, get it using wget instead:

$ wget http://downloads.nas-central.org/Users/khisanth/rtorrent-0.7.7-lspro-jtymod.gz

To unzip the gzip file: $ gunzip -c rtorrent-0.7.7-lspro-jtymod.gz > rtorrent To change executable permissions: $ chmod 755 rtorrent $ chmod 755 screen

Getting Screen to Work
I found that I needed to change the permission of /dev/ptmx to get screen to work for non-root users. Log in as root, then: $ chmod 666 /dev/ptmx

Getting the config file
.rtorrent.rc is a config file that controls the behavior of rtorrent, including which directory it should monitor for new torrent files.

You can find a copy of it in the official client under /doc/rtorrent.rc

Direct link to .rtorrent.rc

Rename it to .rtorrent.rc and put it in your home directory.

Modifying .rtorrent.rc
You just need to uncomment whichever option you want. See the rTorrent man page for more details. Here's what I changed:

1. # Global upload and download rate in KiB. "0" for unlimited. download_rate = 300 upload_rate = 15

2.  # Default directory to save the downloaded torrents. directory = /mnt/disk1/share/torrents/

3.  # Default session directory. session = /mnt/disk1/share/torrents/session/

4. # Watch a directory for new torrents, and stop those that have been deleted. schedule = watch_directory,5,5,load_start=/mnt/disk1/share/torrents/watch/*.torrent schedule = tied_directory,5,5,start_tied= schedule = untied_directory,5,5,stop_untied=

The first schedule line tells rtorrent which directory to scan for new *.torrent files. It will start 5 seconds after rTorrent is started, and will repeat every 5 seconds. The third line pauses a download when the associated .torrent file is removed from the watch directory. The second line tells rtorrent to resume a download when the .torrent file is put back in the watch directory.

This way you can simply move torrent files in and out of the watch directory to control which files get downloaded.

5. # Stop torrents when reaching upload ratio in percent schedule = ratio,60,60,stop_on_ratio=100

6. port_range = 6890-6890
 * 1) Port range to use for listening.

Remember to open the selected port in your router.

7. # Set whether the client should try to connect to UDP trackers. use_udp_trackers = yes

8. # Encryption options encryption = allow_incoming

Using Screen
screen is a terminal windows manager that allows you to run a terminal in the background. This way, you can start rTorrent in a virtual terminal, send it to the background, and log off your current session.

Step 1) Create a virtual terminal named 'torrent_box' $ screen -S torrent_box

You should now get a blank terminal.

'''Step 2) Run rTorrent $ rtorrent

'''Step 3) Send it to the background Press Ctrl+a+d (Ctrl+a, then press d)

OR, to combine step 1,2,3, you can do

# Launch rtorrent during startup chmod 777 `tty` chmod 666 /dev/ptmx su -  -c "screen -A -m -d -S torrent_box rtorrent"

Those 2 chmod commands are used to make sure screen can use current tty. Remove "su -  -c " if you are going to run rtorrent in the current account. You can put these lines in /etc/rc.local to start rtorrent during boot.

You should see the status [detached] and return to your old terminal. To see which virtual terminals are present, you can use the command: $ screen -list

The torrent_box screen should be visible. Now you can log off and rTorrent will continue to run.

Seeing the Status of Your Torrents
To return to the rTorrent screen, use the command: $ screen -r

Always remember to press Ctrl+a+d to send it back to the background before logging off.

See the rTorrent user guide to learn how to work with the rTorrent interface.