2010年10月22日

rTorrent相關設定

本文適用於Archlinux 2010.05
本文適用於rtorrent 0.8.6


需先安裝rtorrent
pacman -S rtorrent
一般設定
~/.rtorrent.rc
# 每個種子的最大與最小連接數
#min_peers = 40
#max_peers = 52

#
已完成種子的最大與最小連接數,"-1"為同上
#min_peers_seed = 10
#max_peers_seed = 52

# 最大做種數
#max_uploads = 8

# 總流量 (KiB),"0"為不限制
download_rate = 0
upload_rate = 50

# 預設儲存目錄
directory = /media/Data/Downloads/Temp
# 下載完成時移動檔案
system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d$
# 讀取種子後移動種子到目錄
system.method.set_key = event.download.inserted_new,remove_sourcetor,"execute=r$

#下載歷史目錄(此目錄中包括下載進度信息和DHT節點緩存)
session = ./.session/


# 自動讀取資料夾中的種子
schedule = watch_directory,5,5,load_start=/media/Data/*.torrent
#schedule = untied_directory,5,5,stop_untied=
#schedule = tied_directory,5,5,start_tied=

# 硬碟空間不足時停止下載
schedule = low_diskspace,5,60,close_low_diskspace=100M

 
# 分享率達成時停止上傳
ratio.enable=
# 達成分享率
ratio.min.set=100
ratio.max.set=300
ratio.upload.set=20M
# Changing the command triggered when the ratio is reached.
system.method.set = group.seeding.ratio.command, d.close=, d.erase=

#支援UDP Trackers
use_udp_trackers = yes

# Port range to use for listening.
port_range = 49164-49164

# 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

# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plai$
#
# encryption = allow_incoming,enable_retry,prefer_plaintext
encryption = allow_incoming,try_outgoing,enable_retry

# The default is "off". For DHT to work, a session directory must be defined.
dht = auto

# UDP port to use for DHT.
dht_port = 6881

# Enable peer exchange (for torrents not marked private)
peer_exchange = yes

# 字元編碼
encoding_list = UTF-8
scgi_local = /tmp/rpc.socket
schedule = chmod,0,0,"execute=chmod,777,/tmp/rpc.socket"


開機自動執行
需先安裝screen 
pacman -S screen
/etc/rc.d/rtorrent:

#!/bin/sh
. /etc/rc.conf
. /etc/rc.d/functions
ppid=$(pidof rtorrent)
case "$1" in
  start)
    stat_busy "Starting rtorrent"
    [ -z "$ppid" ]
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /tmp/rpc.socket 2> /dev/null
      su - USERNAME -c "screen -A -m -d -S rtorrent /usr/bin/rtorrent" &
      add_daemon rtorrent
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping rtorrent"
    [ ! -z "$ppid" ]  && kill -int ${ppid}
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /tmp/rpc.socket
      rm_daemon rtorrent
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "Usage: {start|stop|restart}" >&2
    exit 1
    ;;
esac
exit 0 


中間的USERNAME要改成執行時要使用的身分
 
/etc/rc.conf:
在DAEMONS中加入 rtorrent

2 則留言: