NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Etz
Mar 21, 2012Aspirant
ruTorrent 3.3 + rTorrent by WhoCares
Can someone explain, how to configure download directories and other settings? It always defaults back to factory settings if you reboot ReadyNAS or restart addon. It`s a known behaviour of ruTorr...
Dewdman42
Jun 20, 2012Virtuoso
Well first thanks a lot to WhoCares for putting this addon together. I would not have tried rtorrent without it.
That being said, here are some tweaks I have done in order to make it really work as it should. Perhaps future addon release may incorporate some of these fixes, but in the meantime it may help some of you that are having problems with it.
First I will list high level summary of what was tweaked and then some details. Lastly I will list some future things I want to look into for later. Brace yourself this is a lot to read, but if you're serious about using rtorrent I think you'll find this useful. I have discovered rtorrent to be extremely powerful. I'm removing both utorrent and transmission (if I can figure out how to remove transmission) from my machine.
Summary
That being said, here are some tweaks I have done in order to make it really work as it should. Perhaps future addon release may incorporate some of these fixes, but in the meantime it may help some of you that are having problems with it.
First I will list high level summary of what was tweaked and then some details. Lastly I will list some future things I want to look into for later. Brace yourself this is a lot to read, but if you're serious about using rtorrent I think you'll find this useful. I have discovered rtorrent to be extremely powerful. I'm removing both utorrent and transmission (if I can figure out how to remove transmission) from my machine.
Summary
- rtorrent.rc was excluded from the addon. Include it so that various configuration options can be used, which are not possible without it.
- session was not configured. Configured for use of session. A configured session dir allows you to stop and restart rtorrent and have it remember all the torrents you had loaded.
- Changed some things in the frontview startup scripts
- Configured file permission umask of downloaded files so that I can access from share without being admin user.
- Set up watch folders, more to do here, this is very powerful feature.
- configured encryption
- .rtorrent.rc is per user, there is no way to override this with rtorrent. Since this addon is configured to run rtorrent as admin, simply create the following file:
~admin/.rtorrent.rc
You can search the web and find tons of examples for what to put into this file. It turns out that rtorrent is quite more powerful then I realized, with the ability to create event driven scripts. I'm still learning. Due to the size of it, I put my version of the file at the end of this post. - In order to enable the .rtorrent.rc file, the startup script has to be modified, to exclude the -n option. That script is found in:
/etc/frontview/addons/bin/RUTORRENT/RUTORRENT_service
- Once you have rtorrent picking up the rc file for config, you can move several other configuration items into there instead of from the command line at startup. The startup script has the download dir hardoded to /c/media, for example. It also has the port range specified here, though its configurable through frontview. I moved everything into the rc file, my RUTORRENT_service file now looks like this:
#!/bin/bash
Note - I also added the line to remove the sock file since I found that sometimes during testing this file got left hanging around and made it impossible to start rtorrent again. Maybe there is a better approach for that.
. /etc/default/services
. /etc/frontview/addons/ui/RUTORRENT/rutorrent.config
rm /tmp/rutorrent.sock
/usr/bin/rtorrent -o scgi_local=/tmp/rutorrent.sock - The following lines have to be added to ~admin/.rtorrent.rc in order to provide what was previously in the RUTORRENT_service cmd line. Use whatever dir and ports you want
# Default directory to save the downloaded torrents.
There are more things in that file to configure, see my example at the end. But those two entries accomplish what was previously done in the startup script.
directory = /c/raid/extra/partial
# Port range to use for listening.
port_range = 31667-31767 - The session concept is used to remember torrents you want loaded when you stop and start rtorrent. In order to use a session, create a directory somewhere for it and then add a line to .rtorrent.rc. Mine is this:
session = /c/.rtorrent/session
- Files downloaded with rtorrent are owned by admin.admin and not writeable by everyone. You can add the following line to .rtorrent.rc which will chmod all downloads to rwxrwxrwx:
# chmod rwx for everybody
system.umask.set = 0000 - I want encryption turned on always. This is configured with the following line in .rtorrent.rc
encryption = require
- rtorrent has powerful watch folder capability, I am just barely scratching the surface. You can add the following bit to .rtorrent.rc. What this accomplishes is that when you drop a .torrent file into the specified watch dir, it will detect it, add the torrent to the session and start downloading to the default download dir(specified above). However, when its complete, it will move the downloaded file to the final destination folder specified. So in this case, the torrents will download into the partial folder and when they are complete will move to downloads.
note, you can create more than one of these, I created two here so you can see, but you can create as many as you want. So that you drop your torrents into one of several different watch folders, which will determine where the final completed download will end up# Schedules to watch folders
schedule = watch_directory_1,11,20,"load_start=/c/raid/extra/rtorrent/watch/*.torrent,d.set_custom1=/c/raid/extra/downloads/"
schedule = watch_directory_2,12,20,"load_start=/c/raid/extra/rtorrent/watch/music/*.torrent,d.set_custom1=/c/raid/extra/music/"
# Move completed downloads to preset target
system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
Note also the system.method line added. This is an event driven script which does the moving of the final file. Google around to learn more about what rtorrent can do. - There are several other parameters in .rtorrent.rc which I uncommented and configured, see my complete file below.
- There are ways to also have the .torrent files moved when the torrent is started and/or when its completed. I want to trick that out also so that when I drop a torrent file into a watch dir, rtorrent will pick it up, add it to the session and then move the torrent file someplace else for safe keeping.
- There are some interesting options only available through patches and recompile of rtorrent. The most important one is ipfilter capability. Another one is the ability to preallocate downloads to their full size. A third one is related to the next item.
- By adding the "equal" patch and compiling rtorrent, its possible to reseed things using the watch folders. This is complicated to explain but basically the watch drop folder trick mentioned above only works for new torrents. if you want to reseed something you downloaded a long time ago, then if you try to drop it into watch its going to either re-download it, or if you move the downloaded content to the default download dir and try to drop the torrent file into the watch folder, it will see its finished, but will not move it back and continue seeding. There is a solution I found, https://wiki.archlinux.org/index.php/Rtorrent#Manage_completed_files but it requires the "equal" patch.
- I would like to see if I can run rtorrent as myself instead of admin, since I own all dirs where torrents might end up. I have found that if I create a folder through my NAS sharing as myself and then try to point rtorrent to download there, it will fail unless I also made sure to chmod that dir 777. If rtorrent was running as me it would never have this problem. However, when I tried to change the startup script to run as me, it didn't quite work with ruTorrent correctly. This is probably fixable, but I didn't have time to figure it out.
- rtorrent has the ability to auto create labels somehow, I need to figure that out.
- I would like to configure rtorrent to make sure it never consumes more than X amount of ram memory. I can see the parameter in the ruTorrent gui, but not sure where to configure that in .rtorrent.rc yet.
- I modified the startup.sh script to execute rtorrent with a nicelevel set to lower priority. This is entirely optional. The file in question is
/etc/frontview/addons/bin/RUTORRENT/start.sh
and I added --nicelevel 19 just before -x. So the final file looks like this:#!/bin/bash
#
# This should contain necessary code to start the service
screen -dmS "rtorrent" start-stop-daemon -S -m --pidfile /var/run/RUTORRENT.pid -c admin:admin -q --nicelevel 19 -x /etc/frontview/addons/bin/RUTORRENT/RUTORRENT_service
RTOR=`ps ax | grep rtorrent | grep -v SCREEN | grep -v grep | awk '{ print $1 }'`
if [ "$RTOR" != "" ]; then
echo $RTOR > /var/run/RUTORRENT.pid
fi - Here is my full .rtorrent.rc as of now
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
#max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
#max_peers_seed = 50
# Maximum number of simultanious uploads per torrent.
#max_uploads = 15
# Global upload and download rate in KiB. "0" for unlimited.
#download_rate = 0
#upload_rate = 0
# Default directory to save the downloaded torrents.
directory = /c/raid/extra/partial
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /c/.rtorrent/session
# Watch a directory for new torrents, and stop those that have been
# deleted.
#schedule = watch_directory,5,5,load_start=./watch/*.torrent
#schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low.
#schedule = low_diskspace,5,60,close_low_diskspace=100M
# The ip address reported to the tracker.
#ip = 127.0.0.1
# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no
# Port range to use for listening.
port_range = 31667-31767
# Start opening ports at a random position within the port range.
port_random = yes
# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
check_hash = yes
# Set whetever the client should try to connect to UDP trackers.
#use_udp_trackers = yes
# Alternative calls to bind and ip that should handle dynamic ip's.#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
#encryption = require,enable_retry,prefer_plaintext
encryption = require
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
dht = disable
# UDP port to use for DHT.
#
# dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
# peer_exchange = yes
# chmod rwx for everybody
system.umask.set = 0000
# Schedules to watch folders
schedule = watch_directory_1,11,20,"load_start=/c/raid/extra/rtorrent/watch/*.torrent,d.set_custom1=/c/raid/extra/downloads/"
schedule = watch_directory_2,12,20,"load_start=/c/raid/extra/rtorrent/watch/music/*.torrent,d.set_custom1=/c/raid/extra/music/"
# Move completed downloads to preset target
system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
#
# Do not modify the following parameters unless you know what you're doing.
#
# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
#hash_read_ahead = 10
# Interval between attempts to check the hash, in milliseconds.
#hash_interval = 100
# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
#hash_max_tries = 10
Details
Future
Notes
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!