############################################################################# # A minimal rTorrent configuration that provides the basic features # you want to have in addition to the built-in defaults. # # See https://github.com/rakshasa/rtorrent/wiki/CONFIG-Template # for an up-to-date version. ############################################################################# # Instance layout (base paths) method.insert = cfg.basedir, private|const|string, (cat,"/mnt/media/") method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/") method.insert = cfg.logs, private|const|string, (cat,"/var/log/rtorrent/") # Create instance directories execute.throw = bash, -c, (cat,\ "builtin cd \"", (cfg.basedir), "\" ",\ "&& mkdir -p .session download watch/{load,start}") ############################################################################# # Network ############################################################################# # Listening port for incoming peer traffic (fixed; you can also randomize it) # network.port_range.set = 6881-6881 network.port_random.set = no # Get Public IP method.insert = get_public_ip_address, simple|private, "execute.capture=bash,-c,\"eval echo -n \$(natpmpc -g 10.2.0.1 -a 1 0 tcp 60 | awk '/Public IP address :/ { print $5 }')\"" schedule2 = ip_tick, 5, 45, "network.local_address.set=(get_public_ip_address)" # Get Forwarded port method.insert = get_port_forward, simple|private, "execute.capture=bash,-c,\"eval echo -n \$(natpmpc -g 10.2.0.1 -a 1 0 tcp 60 | awk '/Mapped public port/ { print $4 }')\"" schedule2 = port_tick, 6, 45, "network.port_range.set=(get_port_forward)" # Tracker-less torrent and UDP tracker support # (conservative settings for 'private' trackers, change for 'public') dht.mode.set = disable protocol.pex.set = no trackers.use_udp.set = yes # XMLRPC network.scgi.open_local = /run/rtorrent/rpc.sock execute.nothrow = chmod,777,/run/rtorrent/rpc.sock ############################################################################# # Throttles & Limits ############################################################################# throttle.max_uploads.set = 250 throttle.max_uploads.global.set = 500 throttle.min_peers.normal.set = 1 throttle.max_peers.normal.set = 60 throttle.min_peers.seed.set = 1 throttle.max_peers.seed.set = 80 trackers.numwant.set = 20 protocol.encryption.set = allow_incoming,try_outgoing,enable_retry # Limits for file handle resources, this is optimized for # an `ulimit` of 1024 (a common default). You MUST leave # a ceiling of handles reserved for rTorrent's internal needs! network.http.max_open.set = 500 network.max_open_files.set = 12000 network.max_open_sockets.set = 6000 ############################################################################# # Base Settings ############################################################################# # Memory resource usage (increase if you have a large number of items loaded, # and/or the available resources to spend) pieces.memory.max.set = 16000M network.xmlrpc.size_limit.set = 4M # Basic operational settings (no need to change these) session.path.set = (cat, (cfg.basedir), ".session") directory.default.set = (cat, (cfg.basedir), "download/") execute.nothrow = bash, -c, (cat, "echo >",\ (session.path), "rtorrent.pid", " ", (system.pid)) # Other operational settings (check & adapt) encoding.add = utf8 system.umask.set = 0027 system.cwd.set = (directory.default) network.http.dns_cache_timeout.set = 25 # Some additional values and commands method.insert = system.startup_time, value|const, (system.time) method.insert = d.data_path, simple,\ "if=(d.is_multi_file),\ (cat, (d.directory), /),\ (cat, (d.directory), /, (d.name))" method.insert = d.session_file, simple, "cat=(session.path), (d.hash), .torrent" # Watch directories (add more as you like, but use unique schedule names) schedule2 = watch_start, 10, 10, ((load.start_verbose, (cat, (cfg.watch), "start/*.torrent"))) schedule2 = watch_load, 11, 10, ((load.verbose, (cat, (cfg.watch), "load/*.torrent"))) ############################################################################# # Log Rotation, Archival, and Pruning ############################################################################# # Settings for archival delay, and retention [days] method.insert.value = pyro.log_retention.days, 2 method.insert.value = pyro.log_archival.days, 7 # Create HUGE xmlrpc log files? method.insert.value = pyro.log.xmlrpc.enabled, 0 method.insert.value = pyro.extended, 0 method.insert.value = pyro._log.xmlrpc.closing, 0 # Create a "YYYY-mm-dd-HHMMSS" time stamp method.insert = pyro.date_iso.log_stamp, simple|private,\ "execute.capture_nothrow = bash, -c, \"echo -n $(date +%Y-%m-%d-%H%M%S)\"" # String value for the currently used time stamp, changed on rotation method.insert = pyro.log_stamp.current, string # Create a full logfile path using the current stamp method.insert = pyro.logfile_path, simple|private,\ "cat = (cfg.logs), (argument.0), \"-\", (pyro.log_stamp.current), .log" # (Re-)open all logs with a current time stamp; the main log file # is just opened, you need to add some logging scopes yourself! method.insert = pyro.log_rotate, multi|rlookup|static method.set_key = pyro.log_rotate, !stamp,\ "pyro.log_stamp.current.set = (cat, (pyro.date_iso.log_stamp))" method.set_key = pyro.log_rotate, execute,\ "log.execute = (pyro.logfile_path, execute)" method.set_key = pyro.log_rotate, messages,\ "branch = (pyro.extended), ((log.messages, (pyro.logfile_path, messages) ))" method.set_key = pyro.log_rotate, xmlrpc,\ "branch = pyro.log.xmlrpc.enabled=, \"log.xmlrpc=(pyro.logfile_path, xmlrpc)\", \ \"log.xmlrpc=(pyro._log.xmlrpc.closing)\"" method.set_key = pyro.log_rotate, ~main,\ "log.open_file = log, (pyro.logfile_path, rtorrent)" # Logrotate schedule (rotating shortly after 1AM, so DST shenanigans # are taken care of, and rotation is always near the begin of the next day) schedule2 = pyro_daily_log_rotate, 01:05:00, 24:00:00, ((pyro.log_rotate)) # Log file archival and pruning method.insert = pmb._logfile_find_cmd, simple|private,\ "cat = \"find \", (cfg.logs),\ \" -daystart -type f -name '*.\", (argument.0),\"'\",\ \" -mtime +\", (argument.1),\ \" -exec nice \", (argument.2), \" '{}' ';'\"" schedule2 = pyro_logfile_archival, 01:10:00, 24:00:00,\ "execute.nothrow = bash, -c, (pmb._logfile_find_cmd, log, (pyro.log_archival.days), gzip)" schedule2 = pyro_logfile_pruning, 01:20:00, 24:00:00,\ "execute.nothrow = bash, -c, (pmb._logfile_find_cmd, log.gz, (pyro.log_retention.days), rm)" # Open logs initially on startup # pyro.log_rotate= schedule2 = pyro_startup_log_xmlrpc_open, 7, 0, \ "branch = pyro.log.xmlrpc.enabled=, \"log.xmlrpc=(pyro.logfile_path, xmlrpc)\"" pyro.log_stamp.current.set = (cat, (pyro.date_iso.log_stamp)) log.open_file = log, (pyro.logfile_path, rtorrent) log.add_output = "info", "log" # log.add_output = "tracker_info", "log" log.execute = (pyro.logfile_path, execute) ### END of rtorrent.rc ###