「RTorrent」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(カテゴリ変更)
(2人の利用者による、間の12版が非表示)
1行目: 1行目:
 
{{DISPLAYTITLE:rTorrent}}
 
{{DISPLAYTITLE:rTorrent}}
[[Category:インターネットアプリケーション]]
+
[[Category:BitTorrent]]
 
[[en:RTorrent]]
 
[[en:RTorrent]]
 
[[es:RTorrent]]
 
[[es:RTorrent]]
 
[[ru:RTorrent]]
 
[[ru:RTorrent]]
[[zh-CN:RTorrent]]
+
[[zh-hans:RTorrent]]
 
[https://rakshasa.github.io/rtorrent/ rTorrent] は迅速に動作する BitTorrent クライアントです。開発面では、libTorrent ライブラリを使用しています ({{Pkg|libtorrent-rasterbar}} とは違います)。rTorrent は C++ を使って書かれており、[[Wikipedia:ja:ncurses|ncurses]] プログラミングライブラリを利用したテキストユーザーインターフェイスがあります。ターミナルマルチプレクサ (例: [[GNU Screen]] や [[Tmux]]) と [[Secure Shell]] を一緒に使うことで、便利なリモート [[Wikipedia:BitTorrent (protocol)#Operation|BitTorrent クライアント]]として活用できます。
 
[https://rakshasa.github.io/rtorrent/ rTorrent] は迅速に動作する BitTorrent クライアントです。開発面では、libTorrent ライブラリを使用しています ({{Pkg|libtorrent-rasterbar}} とは違います)。rTorrent は C++ を使って書かれており、[[Wikipedia:ja:ncurses|ncurses]] プログラミングライブラリを利用したテキストユーザーインターフェイスがあります。ターミナルマルチプレクサ (例: [[GNU Screen]] や [[Tmux]]) と [[Secure Shell]] を一緒に使うことで、便利なリモート [[Wikipedia:BitTorrent (protocol)#Operation|BitTorrent クライアント]]として活用できます。
   
11行目: 11行目:
 
[[公式リポジトリ]]の {{Pkg|rtorrent}} パッケージを[[インストール]]してください。
 
[[公式リポジトリ]]の {{Pkg|rtorrent}} パッケージを[[インストール]]してください。
   
もしくは、[[AUR]] から {{AUR|rtorrent-git}} か {{AUR|rtorrent-extended}} をインストールしてください。
+
もしくは、[[AUR]] から {{AUR|rtorrent-git}} か {{AUR|rtorrent-extended}}{{Broken package link|{{aur-mirror|rtorrent-extended}}}} をインストールしてください。
   
 
== 設定 ==
 
== 設定 ==
   
{{Note|See the rTorrent wiki article on this subject for more information: [http://web.archive.org/web/20140213003955/http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks Common Tasks in rTorrent for Dummies].}}
+
{{Note|設定に関する詳細は次の rTorrent wiki の記事を見て下さい: [https://web.archive.org/web/20140213003955/http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks Common Tasks in rTorrent for Dummies]}}
   
 
rTorrent を実行する前に、サンプル設定ファイル {{ic|/usr/share/doc/rtorrent/rtorrent.rc}} を探して {{ic|~/.rtorrent.rc}} にコピーしましょう:
 
rTorrent を実行する前に、サンプル設定ファイル {{ic|/usr/share/doc/rtorrent/rtorrent.rc}} を探して {{ic|~/.rtorrent.rc}} にコピーしましょう:
23行目: 23行目:
 
=== パフォーマンス ===
 
=== パフォーマンス ===
   
{{Note|See the rTorrent wiki article on this subject for more information: [http://web.archive.org/web/20140213011439/http://libtorrent.rakshasa.no/wiki/RTorrentPerformanceTuning Performance Tuning]}}
+
{{Note|パフォーマンスに関する詳細は次の rTorrent wiki の記事を見て下さい: [https://web.archive.org/web/20140213011439/http://libtorrent.rakshasa.no/wiki/RTorrentPerformanceTuning Performance Tuning]}}
   
 
以下のオプションの値はシステムのハードウェアやインターネットの接続速度に合わせます。最適値の見つけ方については次を読んでください: [http://torrentfreak.com/optimize-your-BitTorrent-download-speed Optimize Your BitTorrent Download Speed]
 
以下のオプションの値はシステムのハードウェアやインターネットの接続速度に合わせます。最適値の見つけ方については次を読んでください: [http://torrentfreak.com/optimize-your-BitTorrent-download-speed Optimize Your BitTorrent Download Speed]
39行目: 39行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
{{ic|check_hash}} オプションは torrent のダウンロードが完了した時や rTorrent が起動したときにハッシュチェックを行います。起動時に、完了済みのファイルに問題がないか確認します。
The {{ic|check_hash}} option executes a hash check when a torrent download is complete or rTorrent is started. When starting, it checks for errors in your completed files.
 
 
check_hash = yes
 
check_hash = yes
   
 
=== ファイルの作成と管理 ===
 
=== ファイルの作成と管理 ===
   
  +
{{ic|directory}} オプションには torrent データを保存するディレクトリを指定します (相対パスでも指定できます):
The {{ic|directory}} option will determine where your torrent data will be saved (could be a relative path):
 
 
directory = ~/downloaded
 
directory = ~/downloaded
   
The {{ic|session}} option allows rTorrent to save the progess of your torrents. It is recommended to create a directory in home directory (e.g. {{ic|mkdir ~/.rtorrent.session}}).
+
{{ic|session}} オプションを使うことで rTorrent torrent の進捗を保存することができます。ホームディレクトリにディレクトリを作成することが推奨されます (例: {{ic|mkdir ~/.rtorrent.session}})
 
session = ~/.rtorrent.session
 
session = ~/.rtorrent.session
   
  +
{{ic|schedule}} オプションを設定すると rTorrent は新しい torrent ファイルが追加されないか特定のディレクトリを監視します。このディレクトリに torrent ファイルを保存すると、自動的にダウンロードが開始されます。かならず監視するディレクトリを作成してください (例: {{ic|mkdir ~/watch}})。また、このオプションを使用すると、rTorrent が torrent ファイルをセッションフォルダに移動してハッシュ値に名前を変更するので注意してください。
The {{ic|schedule}} option has rTorrent watch a particular directory for new torrent files. Saving a torrent file to this directory will automatically start the download. Remember to create the directory that will be watched (e.g. {{ic|mkdir ~/watch}}). Also, be careful when using this option as rTorrent will move the torrent file to your session folder and rename it to its hash value.
 
 
schedule = watch_directory,5,5,load_start=/home/''user''/watch/*.torrent
 
schedule = watch_directory,5,5,load_start=/home/''user''/watch/*.torrent
 
schedule = untied_directory,5,5,stop_untied=
 
schedule = untied_directory,5,5,stop_untied=
 
schedule = tied_directory,5,5,start_tied=
 
schedule = tied_directory,5,5,start_tied=
   
  +
以下の {{ic|schedule}} オプションはディスク容量が少なくなった時に rTorrent がデータをダウンロードするのを止めさせます。
The following {{ic|schedule}} option is intended to stop rTorrent from downloading data when disk space is low.
 
 
schedule = low_diskspace,5,60,close_low_diskspace=100M
 
schedule = low_diskspace,5,60,close_low_diskspace=100M
   
 
=== ポート設定 ===
 
=== ポート設定 ===
   
  +
{{ic|port_range}} オプションでは使用するポートを設定します。49152 以上のポート番号を使用することが推奨されます (参照: [[Wikipedia:ja:TCPやUDPにおけるポート番号の一覧|ポート番号の一覧]])。rTorrent ではポートの範囲を指定することができますが、使用するポートは一つだけに絞ることが推奨されています。
The {{ic|port_range}} option sets which port(s) to use for listening. It is recommended to use a port that is higher than 49152 (see: [[Wikipedia:List of TCP and UDP port numbers|List of port numbers]]). Although, rTorrent allows a range of ports, a single port is recommended.
 
 
port_range = 49164-49164
 
port_range = 49164-49164
   
Additionally, make sure port forwarding is enabled for the proper port(s) (see: [http://portforward.com/english/routers/port_forwarding/routerindex.htm Port Forward guides]).
+
また、適切なポートのポートフォワーディングが有効になっていることを確認してください (参照: [http://portforward.com/english/routers/port_forwarding/routerindex.htm Port Forward guides])
   
 
=== その他の設定 ===
 
=== その他の設定 ===
   
  +
{{ic|encryption}} オプションは暗号化を有効化または無効化します。このオプションは、あなた自身だけのためではなく、torrent スウォームのピアのためでもあります。たとえセキュリティを上げる必要がなかったとしても、有効にすることに害はありません。
The {{ic|encryption}} option enables or disables encryption. It is very important to enable this option, not only for yourself, but also for your peers in the torrent swarm. Some users need to obscure their bandwidth usage from their ISP. And it does not hurt to enable it even if you do not need the added security.
 
 
encryption = allow_incoming,try_outgoing,enable_retry
 
encryption = allow_incoming,try_outgoing,enable_retry
  +
また、全ての接続で強制的に暗号化を使用することもできます。ただし、あまり厳しいルールを使用するとクライアントの可用性が減少していきます:
It is also possible to force all connections to use encryption. However, be aware that this stricter rule will reduce your client's availability:
 
 
encryption = require,require_RC4,allow_incoming,try_outgoing
 
encryption = require,require_RC4,allow_incoming,try_outgoing
   
See also [[Wikipedia:BitTorrent Protocol Encryption]].
+
[[Wikipedia:BitTorrent Protocol Encryption]] も見て下さい。
   
  +
最後に、{{ic|dht}} オプションは [[Wikipedia:ja:分散ハッシュテーブル|DHT]] のサポートを有効にします。DHT は主要なトラッカーで使われており、クライアントがより多くのピアを獲得できるようになります。
This final {{ic|dht}} option enables [[Wikipedia:Distributed hash table|DHT]] support. DHT is common among public trackers and will allow the client to acquire more peers.
 
 
{{bc|<nowiki>
 
{{bc|<nowiki>
 
dht = auto
 
dht = auto
83行目: 83行目:
 
== キーバインディング ==
 
== キーバインディング ==
   
rTorrent relies exclusively on keyboard shortcuts for user input. A quick reference is available in the table below. A complete guide is available on the rTorrent wiki (see: [https://github.com/rakshasa/rtorrent/wiki/User-Guide rTorrent User Guide]).
+
rTorrent では専らキーボードショートカットを使って操作を行います。下のクイックレファレンスを参照してください。完全なガイドは rTorrent wiki にあります (参照: [https://github.com/rakshasa/rtorrent/wiki/User-Guide rTorrent User Guide])
   
 
{{Note|Striking {{ic|Ctrl-q}} twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.}}
 
{{Note|Striking {{ic|Ctrl-q}} twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.}}
89行目: 89行目:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
!width="75" |Cmd
+
!width="75" |コマンド
  +
!操作
!Action
 
 
|-
 
|-
 
|Ctrl-q
 
|Ctrl-q
  +
|アプリケーションを終了
|Quit application
 
 
|-
 
|-
 
|Ctrl-s
 
|Ctrl-s
  +
|ダウンロードを開始。ハッシュが行われていない場合は先に実行
|Start download. Runs hash first unless already done.
 
 
|-
 
|-
 
|Ctrl-d
 
|Ctrl-d
  +
|ダウンロードを停止または停止したダウンロードを削除
|Stop an active download or remove a stopped download
 
 
|-
 
|-
 
|Ctrl-k
 
|Ctrl-k
  +
|ファイルのダウンロードを停止して終了
|Stop and close the files of an active download.
 
 
|-
 
|-
 
|Ctrl-r
 
|Ctrl-r
  +
|torrent のハッシュチェックを開始。ダウンロード/アップロードは行わない。
|Initiate hash check of torrent. Without starting to download/upload.
 
 
|-
 
|-
 
|Left
 
|Left
  +
|前の画面に戻る
|Returns to the previous screen
 
 
|-
 
|-
 
|Right
 
|Right
  +
|次の画面に移る
|Goes to the next screen
 
 
|-
 
|-
 
|Backspace/Return
 
|Backspace/Return
|Adds the specified *.torrent
+
|指定した *.torrent を追加
 
|-
 
|-
 
|<nowiki>a|s|d</nowiki>
 
|<nowiki>a|s|d</nowiki>
|<nowiki>Increase global upload throttle about 1|5|50 KB/s</nowiki>
+
|<nowiki>全体のアップロード速度を 1|5|50 KB/s 間隔で増やす</nowiki>
 
|-
 
|-
 
|<nowiki>A|S|D</nowiki>
 
|<nowiki>A|S|D</nowiki>
|<nowiki>Increase global download throttle about 1|5|50 KB/s</nowiki>
+
|<nowiki>全体のダウンロード速度を 1|5|50 KB/s 間隔で増やす</nowiki>
 
|-
 
|-
 
|<nowiki>z|x|c</nowiki>
 
|<nowiki>z|x|c</nowiki>
|<nowiki>Decrease global upload throttle about 1|5|50 KB/s</nowiki>
+
|<nowiki>全体のアップロード速度を 1|5|50 KB/s 間隔で減らす</nowiki>
 
|-
 
|-
 
|<nowiki>Z|X|C</nowiki>
 
|<nowiki>Z|X|C</nowiki>
|<nowiki>Decrease global download throttle about 1|5|50 KB/s</nowiki>
+
|<nowiki>全体のダウンロード速度を 1|5|50 KB/s 間隔で減らす</nowiki>
 
|}
 
|}
   
 
=== マッピングの重複 ===
 
=== マッピングの重複 ===
   
  +
{{ic|Ctrl-s}} は画面の出力の停止に、{{ic|Ctrl-q}} は画面の出力の開始に使われるのがターミナルでは普通です。これらのマッピングが rTorrent と干渉してしまうことがあります。ターミナルのオプションがマッピングと関連付けられていないか確認してください:
{{ic|Ctrl-s}} is often used for terminal control to stop screen output while {{ic|Ctrl-q}} is used to start it. These mappings may interfere with rTorrent. Check to see if these terminal options are bound to a mapping:
 
 
{{hc|$ stty -a|<nowiki>...
 
{{hc|$ stty -a|<nowiki>...
 
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
 
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
137行目: 137行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
マッピングを削除するには、ターミナルの特性を変更して前述の特殊文字列を定義します (つまり {{ic|stop}} と {{ic|start}}):
To remove the mappings, change the terminal characteristics to undefine the aforementioned special characters (i.e. {{ic|stop}} and {{ic|start}}):
 
 
# stty stop undef
 
# stty stop undef
 
# stty start undef
 
# stty start undef
   
  +
前述のコマンドを {{ic|~/.bashrc}} ファイルに追加することで、起動時に自動的にマッピングを削除させることができます。
To remove these mappings automatically at startup you may add the two preceding commands to your {{ic|~/.bashrc}} file.
 
   
  +
== ヒントとテクニック‎ ==
== Tips and Tricks ==
 
   
 
=== tmux や screen を使用する systemd サービスファイル ===
 
=== tmux や screen を使用する systemd サービスファイル ===
   
  +
*tmux を使用 (rtorrent がクラッシュした場合に再起動)
*With tmux
 
  +
{{hc|/etc/systemd/user/rt.service|<nowiki>
 
{{hc|/etc/systemd/system/rt@.service|<nowiki>
 
 
[Unit]
 
[Unit]
 
Description=rTorrent
 
Description=rTorrent
Requires=network.target local-fs.target
+
After=network.target
   
 
[Service]
 
[Service]
 
Type=forking
 
Type=forking
RemainAfterExit=yes
 
 
KillMode=none
 
KillMode=none
User=%I
 
 
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
 
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
+
ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t rt:rtorrent.0 C-q && while pidof rtorrent > /dev/null; do sleep 0.5; echo rtorrent still running...; done"
WorkingDirectory=/home/%I/
+
WorkingDirectory=%h
 
[Install]
 
WantedBy=multi-user.target
 
</nowiki>}}
 
 
*With tmux (Restart rtorrent if crashed)
 
{{hc|/etc/systemd/system/rt@.service|<nowiki>
 
[Unit]
 
Description=rTorrent
 
Requires=network.target local-fs.target
 
 
[Service]
 
Type=forking
 
KillMode=none
 
User=%I
 
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
 
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
 
WorkingDirectory=/home/%I/
 
 
Restart=on-failure
 
Restart=on-failure
   
 
[Install]
 
[Install]
WantedBy=multi-user.target
+
WantedBy=default.target
 
</nowiki>}}
 
</nowiki>}}
   
  +
*rtorrent ユーザーで実行した tmux を使用 (rtorrent がクラッシュした場合に再起動)
*With tmux running as user rtorrent (Restart rtorrent if crashed)
 
 
{{hc|/etc/systemd/system/rtorrent.service|<nowiki>
 
{{hc|/etc/systemd/system/rtorrent.service|<nowiki>
 
[Unit]
 
[Unit]
 
Description=rTorrent Daemon
 
Description=rTorrent Daemon
Requires=network.target local-fs.target
+
After=network.target
   
 
[Service]
 
[Service]
205行目: 184行目:
 
</nowiki>}}
 
</nowiki>}}
   
*With screen
+
*screen を使用
   
{{hc|/etc/systemd/system/rt@.service|<nowiki>
+
{{hc|/etc/systemd/user/rt.service|<nowiki>
 
[Unit]
 
[Unit]
 
Description=rTorrent
 
Description=rTorrent
Requires=network.target local-fs.target
+
After=network.target
   
 
[Service]
 
[Service]
 
Type=forking
 
Type=forking
RemainAfterExit=yes
 
 
KillMode=none
 
KillMode=none
  +
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
User=%I
 
ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent
 
 
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
 
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/%I/
+
WorkingDirectory=%h
   
 
[Install]
 
[Install]
WantedBy=multi-user.target
+
WantedBy=default.target
 
</nowiki>}}
 
</nowiki>}}
   
  +
ブート時に起動:
Start at boot time:
 
# systemctl enable rt@$USER
+
$ systemctl --user enable rt
  +
手動で起動:
Start manually:
 
# systemctl start rt@$USER
+
$ systemctl --user start rt
  +
停止:
Stop:
 
# systemctl stop rt@$USER
+
$ systemctl --user stop rt
  +
rtorrent のセッションにアタッチ:
Attach to rtorrent's session:
 
 
tmux attach -t rt
 
tmux attach -t rt
  +
デタッチ:
Detach:
 
 
Ctrl-b d
 
Ctrl-b d
   
 
=== 事前割り当て ===
 
=== 事前割り当て ===
   
  +
community リポジトリに入っている rTorrent パッケージは事前割り当ての機能が削られています。事前割り当てを有効にして rTorrent をコンパイルすることで、torrent をダウンロードする前にファイルを割り当てることが可能になります。ファイルシステムのフラグメント化を防ぐことができるという利点がありますが、ファイルシステムが fallocate システムコールをサポートしてないかった場合、事前割り当てで遅延が発生することになります。
The rTorrent package in the community repository lacks pre-allocation. Compiling rTorrent with pre-allocation allows files to be allocated before downloading the torrent. The major benefit is that it limits and avoids fragmentation of the filesystem. However, this introduces a delay during the pre-allocation if the filesystem does not support the fallocate syscall natively.
 
   
  +
したがって、ネイティブで fallocate をサポートしている xfs, ext4, btrfs ファイルシステムを使用する場合は、このスイッチを利用することを推奨します。これらのファイルシステムでは事前割り当てで遅延が発生することなく、ファイルシステムのフラグメンテーションを少なくします。他のファイルシステムで事前割り当てを有効にすると遅延が発生します。ただし、ファイルのフラグメント化は防げます。
Therefore this switch is recommended for xfs, ext4 and btrfs filesystems, which have native fallocate syscall support. They will see no delay during preallocation and no fragmented filesystem. Pre-allocation on others filesystems will cause a delay but will not fragment the files.
 
   
  +
事前割り当てを利用できるようには、[[ABS]] ツリーから以下のスイッチを使って libTorrent をリコンパイルしてください:
To make pre-allocation available, recompile libTorrent from the [[ABS]] tree with the following new switch:
 
$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate
+
$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate
   
To enable it, add the following to your {{ic|~/rtorrent.rc}}:
+
有効化するには、以下を {{ic|~/rtorrent.rc}} に追加します:
{{hc|~/rtorrent.rc|<nowiki>
+
{{hc|~/rtorrent.rc|<nowiki>
# Preallocate files; reduces defragmentation on filesystems.
+
# Preallocate files; reduces defragmentation on filesystems.
system.file_allocate.set = yes
+
system.file_allocate.set = yes
 
</nowiki>}}
 
</nowiki>}}
   
255行目: 232行目:
 
{{Note|
 
{{Note|
 
*Currently, this part requires either the git version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.
 
*Currently, this part requires either the git version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.
* If you're having trouble with this tip, it's probably easier to follow [http://web.archive.org/web/20140213003955/http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#Movecompletedtorrentstodifferentdirectorydependingonwatchdirectory this].
+
* If you're having trouble with this tip, it's probably easier to follow [https://web.archive.org/web/20140213003955/http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks#Movecompletedtorrentstodifferentdirectorydependingonwatchdirectory this].
 
}}
 
}}
   
329行目: 306行目:
 
}}
 
}}
   
Also see [http://code.google.com/p/pyroscope/ pyroscope] especially the rtcontrol examples. There is an AUR package.
+
Also see [https://code.google.com/p/pyroscope/ pyroscope] especially the rtcontrol examples. There is an AUR package.
   
 
==== Google メールで通知 ====
 
==== Google メールで通知 ====
359行目: 336行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
*[[公式リポジトリ]]の {{Pkg|s-nail}} パッケージで mailx をインストールしてください。
*Install mailx which is provided by the {{Pkg|s-nail}} package that is found in the [[official repositories]].
 
   
*Clear the {{ic|/etc/mail.rc}} file and enter:
+
*{{ic|/etc/mail.rc}} ファイルを消去して以下を入力:
   
 
{{bc|<nowiki>
 
{{bc|<nowiki>
373行目: 350行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
テキストを送信するために、メッセージを mailx プログラムにパイプします。
Now to send the text, we must pipe a message to the mailx program.
 
  +
*Bash スクリプトを作成:
*Make a Bash script:
 
 
{{hc|/path/to/mail.sh|<nowiki>
 
{{hc|/path/to/mail.sh|<nowiki>
 
echo "$@: Done" | mailx 5551234567@vtext.com
 
echo "$@: Done" | mailx 5551234567@vtext.com
398行目: 375行目:
 
=== アクティブな torrent を表示 ===
 
=== アクティブな torrent を表示 ===
   
  +
デフォルトでは rtorrent はアクティブなタブを正しく表示しません。アクティブな torrent だけを表示するには {{ic|.rtorrent.rc}} に以下の行を追加してください:
The rtorrent doesn't list the active tab properly by default, add this line to your {{ic|.rtorrent.rc}} to show only active torrents
 
 
schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""
 
schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""
   
  +
rTorrent クライアントで {{ic|9}} 押すと動作の変更が確認できます。
Then press {{ic|9}} in your rTorrent client to see the changes in action.
 
   
 
=== 手動でトラッカーを torrent に追加 ===
 
=== 手動でトラッカーを torrent に追加 ===
   
  +
# rTorrent のコンソールビューから編集する torrent を選択。
# Select torrent to edit from rTorrent console view.
 
# Hit {{ic|Ctrl+x}}.
+
# {{ic|Ctrl+x}} を押す。
 
# If you had four trackers type following lines one at a time (always press {{ic|Ctrl+x}} first) to add four more for example:
 
# If you had four trackers type following lines one at a time (always press {{ic|Ctrl+x}} first) to add four more for example:
   
418行目: 395行目:
 
=== CA 証明書 ===
 
=== CA 証明書 ===
   
  +
rTorrent で HTTPS を使用するトラッカーを使う場合、root で以下を実行してください:
To use rTorrent with a tracker that uses HTTPS, do the following as root:
 
   
 
{{bc|
 
{{bc|
427行目: 404行目:
 
}}
 
}}
   
  +
そして rTorrent を次のコマンドで実行してください:
And from now on run rTorrent with:
 
 
$ rtorrent -o http_capath=/etc/ssl/certs
 
$ rtorrent -o http_capath=/etc/ssl/certs
   
If you use GNU Screen, update the {{ic|.screenrc}} configuration file to reflect this change:
+
GNU Screen を使っている場合、変更が適用されるように {{ic|.screenrc}} 設定ファイルを更新:
 
$ screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs
 
$ screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs
   
In rTorrent 0.8.9, set {{ic|<nowiki>network.http.ssl_verify_peer.set=0</nowiki>}} to [https://bbs.archlinux.org/viewtopic.php?pid=981832#p981832 fix the problem].
+
rTorrent 0.8.9 では {{ic|<nowiki>network.http.ssl_verify_peer.set=0</nowiki>}} を設定することで [https://bbs.archlinux.org/viewtopic.php?pid=981832#p981832 問題が修正] されます。
   
For more information see: [https://bbs.archlinux.org/viewtopic.php?pid=331850 rTorrent Error & CA Certificate] and [https://bbs.archlinux.org/viewtopic.php?id=45800 rTorrent Certificates Problem]
+
詳細は次を参照: [https://bbs.archlinux.org/viewtopic.php?pid=331850 rTorrent Error & CA Certificate] [https://bbs.archlinux.org/viewtopic.php?id=45800 rTorrent Certificates Problem]
   
 
=== ディレクトリのロック ===
 
=== ディレクトリのロック ===
   
  +
クラッシュや不正のシャットダウンの後、ときどき rTorrent が動かなくなって、ロックファイルについてエラーを表示することがあります。
rTorrent can sometimes lock up after a crash or incorrect shutdown, and will complain about a lock file.
 
   
 
Per the error message, the file called "'''rtorrent.lock'''" can be found within the hidden folder {{ic|.rtorrentsession}} for your download directory and manually removed.
 
Per the error message, the file called "'''rtorrent.lock'''" can be found within the hidden folder {{ic|.rtorrentsession}} for your download directory and manually removed.
445行目: 422行目:
 
=== Event failed: bad return code ===
 
=== Event failed: bad return code ===
   
  +
system.method.* の行に空白が入っているのが原因です。空白を削除すれば動作するようになります。
This is caused by there being spaces in your system.method.* lines. Remove the spaces and it will work.
 
   
 
== ウェブインターフェイス ==
 
== ウェブインターフェイス ==
   
  +
rTorrent には様々なウェブインターフェイスやフロントエンドが存在しています:
There are numerous web interfaces and front ends for rTorrent including:
 
  +
* [[en2:WTorrent|WTorrent]] は PHP ライブラリの Smarty テンプレートと XMLRPC を使って PHP でプログラミングされた rtorrent のウェブインターフェイスです。
* [[WTorrent]] is a web interface to rtorrent programmed in php using Smarty templates and XMLRPC for PHP library.
 
* [http://code.google.com/p/ntorrent/ nTorrent] is a graphical user interface client to rtorrent (a cli torrent client) written in Java.
+
* [https://code.google.com/p/ntorrent/ nTorrent] rtorrent (cli torrent クライアント) Java で書かれたグラフィカルユーザーインターフェイスです。
* [http://projects.cyla.homeip.net/rtwi/ rTWi] is a simple rTorrent web interface written in PHP.
+
* [https://rtwi.jmk.hu/ rTWi] PHP で書かれたシンプルな rTorrent ウェブインターフェイスです。
* [[Rtgui]] is a web based front end for rTorrent written in PHP and uses XML-RPC to communicate with the rTorrent client.
+
* [[Rtgui]] PHP で書かれたウェブベースの rTorrent フロントエンドで、XML-RPC を使って rTorrent クライアントと対話します。
* [https://github.com/Novik/ruTorrent rutorrent] and [http://forums.rutorrent.org/ Forum] - A web-based front-end with an interface very similar to uTorrent which supports many plugins and advanced features (see also: [[ruTorrent]] and [https://bbs.archlinux.org/viewtopic.php?pid=897577#p897577 Guide on forum]).
+
* [https://github.com/Novik/ruTorrent rutorrent] [http://forums.rutorrent.org/ Forum] - uTorrent とよく似たインターフェイスを持つウェブベースのフロントエンドです。多数のプラグインと高度な機能をサポートしています (参照: [[ruTorrent]] [https://bbs.archlinux.org/viewtopic.php?pid=897577#p897577 Guide on forum])
   
 
{{Note|rTorrent is currently built using [http://xmlrpc-c.sourceforge.net/ XML-RPC for C/C++], which is required for some web interfaces (e.g. ruTorrent).}}
 
{{Note|rTorrent is currently built using [http://xmlrpc-c.sourceforge.net/ XML-RPC for C/C++], which is required for some web interfaces (e.g. ruTorrent).}}
460行目: 437行目:
 
=== XMLRPC インターフェイス ===
 
=== XMLRPC インターフェイス ===
   
  +
rtorrent をウェブインターフェイス (例: rutorrent) で使いたい場合は設定ファイルに以下の行を追加してください:
If you want to use rtorrent with some web interfaces (e.g. rutorrent) you need to add the following line to the configuration file:
 
 
scgi_port = localhost:5000
 
scgi_port = localhost:5000
   
For more information see: [https://github.com/rakshasa/rtorrent/wiki/RPC-Setup-XMLRPC Using XMLRPC with rtorrent]
+
詳細は次を参照: [https://github.com/rakshasa/rtorrent/wiki/RPC-Setup-XMLRPC Using XMLRPC with rtorrent]
   
 
=== マグネットリンクを watch フォルダに torrent ファイルとして保存 ===
 
=== マグネットリンクを watch フォルダに torrent ファイルとして保存 ===
   
  +
{{Note|Rtorrent はネイティブでマグネットリンクによる torrent のダウンロードに対応しています。(Rtorrent を起動して 1 を押すと表示される) メインビューで、エンターを押してください。"load.normal>" にマグネットリンクを貼り付けてエンターを再度押すとダウンロードが開始されます。}}
{{Note| Rtorrent natively supports downloading torrents through magnet links. At the main view (reached by starting Rtorrent and pressing 1), press enter. At "load.normal>" paste the magnet link and press enter again. This will start the download.}}
 
   
  +
マグネットリンクを watch フォルダに自動的に追加したい場合、以下のスクリプトで行うことができます:
If you wish to have magnet links automatically added to your watch folder, here is a script that will do the trick:
 
   
 
#!/bin/bash
 
#!/bin/bash
 
watch_folder=~/.rtorrent/watch
 
watch_folder=~/.rtorrent/watch
 
cd $watch_folder
 
cd $watch_folder
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
+
<nowiki>[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;</nowiki>
 
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
 
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
   
(adapted from http://blog.gonzih.org/blog/2012/02/17/how-to-use-magnet-links-with-rtorrent/).
+
(ソース: http://blog.gonzih.org/blog/2012/02/17/how-to-use-magnet-links-with-rtorrent/)
   
 
Save it, for instance as rtorrent-magnet, give it execution permission, and place it somewhere under your $PATH. Then in Firefox:
 
Save it, for instance as rtorrent-magnet, give it execution permission, and place it somewhere under your $PATH. Then in Firefox:
484行目: 461行目:
 
# Next time you click a magnet link you will be asked which application to open it with. Select the script we just created and you'll be done.
 
# Next time you click a magnet link you will be asked which application to open it with. Select the script we just created and you'll be done.
   
If you want xdg-open to handle this, which you need if you're using chrome instead of firefox, (though gnome and other DE might have their own programs overriding xdg-open) you need to patch xdg-open according to this site [http://www.void.gr/kargig/blog/2012/01/24/open-magnet-urls-with-xdg-open/]
+
If you want xdg-open to handle this, which you need if you're using chrome instead of firefox, (though gnome and other DE might have their own programs overriding xdg-open) you need to create the desktop entry for the rtorrent-magnet script in {{ic|~/.local/share/applications/rtorrent-magnet.desktop}} with the following content:
  +
  +
[Desktop Entry]
  +
Type=Application
  +
Name=rtorrent-magnet
  +
Exec=rtorrent-magnet %U
  +
MimeType=x-scheme-handler/magnet;
  +
NoDisplay=true
  +
  +
Then all you need to do is to register the mimetype using:
  +
$ xdg-mime default rtorrent-magnet.desktop x-scheme-handler/magnet
   
  +
== マグネットを Torrent に変換 ==
but since you do not want to open the magnet with deluge, change deluge for the name of your script
 
  +
{{AUR|magnet2torrent-git}} パッケージを使うことでメタデータをダウンロードして torrent ファイルを作成することができます。
as such adding the following at the right place in the xdg-open code:
 
elif (echo "$1" | grep -q '^magnet:'); then
 
rtorrent-magnet "$1"
 
if [ $? -eq 0 ]; then
 
exit_success
 
fi
 
   
  +
使用方法:
This should be at line 652 at the time of writing, xdg-open 1.1.0 rc1
 
  +
$ magnet2torrent <magnet link> [torrent file]
   
 
== rtorrent-pyro ==
 
== rtorrent-pyro ==
   
{{AUR|rtorrent-pyro}} from the [[AUR]] comes with an extended rtorrent console interface. It doesn't contain the pyroscope tools yet though. If you also need the pyroscope tools see [[#PyroScope]] .
+
[[AUR]] の {{AUR|rtorrent-pyro}}{{Broken package link|{{aur-mirror|rtorrent-pyro}}}} には rtorrent のコンソールインターフェイスが付属しています。pyroscope ツールは含まれていません。pyroscope ツールも必要な場合は [[#PyroScope]] を見て下さい。
   
 
Make sure you add following command to ~/.rtorrent.rc, which makes the asterisk key * to a shortcut for toggling between extended and collapsed view within rtorrent's interface:
 
Make sure you add following command to ~/.rtorrent.rc, which makes the asterisk key * to a shortcut for toggling between extended and collapsed view within rtorrent's interface:
508行目: 491行目:
 
=== PyroScope ===
 
=== PyroScope ===
   
  +
pyroscope のインストール用のディレクトリを作成して、subversion からソースコードをダウンロード・アップデート:
We create a directory for the installation of pyroscope, then download and update the source code from subversion:
 
 
{{bc|<nowiki>mkdir -p ~/.lib
 
{{bc|<nowiki>mkdir -p ~/.lib
 
svn checkout http://pyroscope.googlecode.com/svn/trunk/ ~/.lib/pyroscope
 
svn checkout http://pyroscope.googlecode.com/svn/trunk/ ~/.lib/pyroscope
 
~/.lib/pyroscope/update-to-head.sh</nowiki>}}
 
~/.lib/pyroscope/update-to-head.sh</nowiki>}}
Adding pyroscope bin's PATH to .bashrc:
+
pyroscope のバイナリを {{ic|.bashrc}} の PATH に追加:
 
{{bc|<nowiki>export PATH=$PATH:path_to_the_bin # Example path for pyroscope bin's: /home/user/.lib/pyroscope/bin/</nowiki>}}
 
{{bc|<nowiki>export PATH=$PATH:path_to_the_bin # Example path for pyroscope bin's: /home/user/.lib/pyroscope/bin/</nowiki>}}
Creating the ~/.pyroscope/config.ini:
+
{{ic|~/.pyroscope/config.ini}} を作成:
 
{{bc|<nowiki>pyroadmin --create-config</nowiki>}}
 
{{bc|<nowiki>pyroadmin --create-config</nowiki>}}
   
525行目: 508行目:
 
Optionally: TORQUE: Daemon watchdog schedule. Must be activated by touching the "~/.pyroscope/run/pyrotorque" file!
 
Optionally: TORQUE: Daemon watchdog schedule. Must be activated by touching the "~/.pyroscope/run/pyrotorque" file!
 
You can also just use rtorrent watch dir or give pyro_watchdog a try, which comes with 'treewatch' ability, meaning it also watches for torrents recursively within the given watch path. Further documentation for pyro_watchdog is here:
 
You can also just use rtorrent watch dir or give pyro_watchdog a try, which comes with 'treewatch' ability, meaning it also watches for torrents recursively within the given watch path. Further documentation for pyro_watchdog is here:
[http://code.google.com/p/pyroscope/wiki/QueueManager]
+
[https://code.google.com/p/pyroscope/wiki/QueueManager]
 
To enable pyro_watchdog, add this in ~/.rtorrent.rc and further configurations are in ~/.pyroscope/torque.ini.
 
To enable pyro_watchdog, add this in ~/.rtorrent.rc and further configurations are in ~/.pyroscope/torque.ini.
 
{{bc|<nowiki>schedule = pyro_watchdog,30,300,"pyro.watchdog=~/.pyroscope,-v"</nowiki>}}
 
{{bc|<nowiki>schedule = pyro_watchdog,30,300,"pyro.watchdog=~/.pyroscope,-v"</nowiki>}}
548行目: 531行目:
   
 
* [http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html Manpage for rtorrent]
 
* [http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html Manpage for rtorrent]
* [[Screen ヒント]]
 
 
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] on Wikipedia
 
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] on Wikipedia
 
* [http://community.rutorrent.org/ rTorrent Community Wiki] - Public place for information on rTorrent and any project related to rTorrent, regarding setup, configuration, operations, and development.
 
* [http://community.rutorrent.org/ rTorrent Community Wiki] - Public place for information on rTorrent and any project related to rTorrent, regarding setup, configuration, operations, and development.
* [http://code.google.com/p/pyroscope/ PyroScope] - Collection of command line tools for rTorrent. It provides commands for creating and modifying torrent files, moving data on completion without having multiple watch folders, and mass-controlling download items via rTorrent's XML-RPC interface: searching, start/stop, deleting items with or without their data, etc. It also offers a documented [[Python]] API.
+
* [https://code.google.com/p/pyroscope/ PyroScope] - Collection of command line tools for rTorrent. It provides commands for creating and modifying torrent files, moving data on completion without having multiple watch folders, and mass-controlling download items via rTorrent's XML-RPC interface: searching, start/stop, deleting items with or without their data, etc. It also offers a documented [[Python]] API.
 
* [[en2:Rutorrent with lighttpd|ruTorrent と Lighttpd]]
 
* [[en2:Rutorrent with lighttpd|ruTorrent と Lighttpd]]
 
* [http://wiki.theaveragegeek.com/howto/installing_rtorrent_and_hellanzb_on_centos5_64-bit_vps How-to install rTorrent and Hellanzb on CentOS 5 64-bit VPS]
 
* [http://wiki.theaveragegeek.com/howto/installing_rtorrent_and_hellanzb_on_centos5_64-bit_vps How-to install rTorrent and Hellanzb on CentOS 5 64-bit VPS]
* [http://code.google.com/p/pyroscope/wiki/DebianInstallFromSource Installation guide for rTorrent and Pryoscope on Debian] - Collection of tools for the BitTorrent protocol and especially the rTorrent client
+
* [https://code.google.com/p/pyroscope/wiki/DebianInstallFromSource Installation guide for rTorrent and Pryoscope on Debian] - Collection of tools for the BitTorrent protocol and especially the rTorrent client
 
* [http://mktorrent.sourceforge.net/ mktorrent] - torrent ファイルを作成するためのコマンドラインアプリケーション、[[公式リポジトリ]]の {{Pkg|mktorrent}} でインストールできます。
 
* [http://mktorrent.sourceforge.net/ mktorrent] - torrent ファイルを作成するためのコマンドラインアプリケーション、[[公式リポジトリ]]の {{Pkg|mktorrent}} でインストールできます。
* [https://github.com/kfei/docktorrent docktorrent] - Using Docker, rTorrent and ruTorrent to run a full-featured BitTorrent box.
+
* [https://github.com/kfei/docktorrent docktorrent] - Docker, rTorrent, ruTorrent を使用してフル機能の BitTorrent マシンを実行。
  +
* [https://github.com/nelhage/reptyr reptyr] - another tool to take over a program's TTY (it is in the standard repos). The process may have started being attached to a terminal or to a socket in tmux, screen or dtach.
  +
* [http://caca.zoy.org/wiki/neercs neercs] - a more screen/tmux like tool than reptyr, but, like reptyr, neercs can also "steal" a process that may have started slaved to a terminal or to a socket in tmux, screen or dtach. {{AUR|neercs-git}}{{Broken package link|{{aur-mirror|neercs-git}}}}
   
 
'''フォーラムスレッド'''
 
'''フォーラムスレッド'''

2019年3月1日 (金) 00:19時点における版

rTorrent は迅速に動作する BitTorrent クライアントです。開発面では、libTorrent ライブラリを使用しています (libtorrent-rasterbar とは違います)。rTorrent は C++ を使って書かれており、ncurses プログラミングライブラリを利用したテキストユーザーインターフェイスがあります。ターミナルマルチプレクサ (例: GNU ScreenTmux) と Secure Shell を一緒に使うことで、便利なリモート BitTorrent クライアントとして活用できます。

インストール

公式リポジトリrtorrent パッケージをインストールしてください。

もしくは、AUR から rtorrent-gitAURrtorrent-extendedAUR[リンク切れ: アーカイブ: aur-mirror] をインストールしてください。

設定

ノート: 設定に関する詳細は次の rTorrent wiki の記事を見て下さい: Common Tasks in rTorrent for Dummies

rTorrent を実行する前に、サンプル設定ファイル /usr/share/doc/rtorrent/rtorrent.rc を探して ~/.rtorrent.rc にコピーしましょう:

$ cp /usr/share/doc/rtorrent/rtorrent.rc ~/.rtorrent.rc

パフォーマンス

ノート: パフォーマンスに関する詳細は次の rTorrent wiki の記事を見て下さい: Performance Tuning

以下のオプションの値はシステムのハードウェアやインターネットの接続速度に合わせます。最適値の見つけ方については次を読んでください: Optimize Your BitTorrent Download Speed

min_peers = 40
max_peers = 52

min_peers_seed = 10
max_peers_seed = 52

max_uploads = 8

download_rate = 200
upload_rate = 28

check_hash オプションは torrent のダウンロードが完了した時や rTorrent が起動したときにハッシュチェックを行います。起動時に、完了済みのファイルに問題がないか確認します。

check_hash = yes

ファイルの作成と管理

directory オプションには torrent データを保存するディレクトリを指定します (相対パスでも指定できます):

directory = ~/downloaded

session オプションを使うことで rTorrent の torrent の進捗を保存することができます。ホームディレクトリにディレクトリを作成することが推奨されます (例: mkdir ~/.rtorrent.session)。

session = ~/.rtorrent.session

schedule オプションを設定すると rTorrent は新しい torrent ファイルが追加されないか特定のディレクトリを監視します。このディレクトリに torrent ファイルを保存すると、自動的にダウンロードが開始されます。かならず監視するディレクトリを作成してください (例: mkdir ~/watch)。また、このオプションを使用すると、rTorrent が torrent ファイルをセッションフォルダに移動してハッシュ値に名前を変更するので注意してください。

schedule = watch_directory,5,5,load_start=/home/user/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
schedule = tied_directory,5,5,start_tied=

以下の schedule オプションはディスク容量が少なくなった時に rTorrent がデータをダウンロードするのを止めさせます。

schedule = low_diskspace,5,60,close_low_diskspace=100M

ポート設定

port_range オプションでは使用するポートを設定します。49152 以上のポート番号を使用することが推奨されます (参照: ポート番号の一覧)。rTorrent ではポートの範囲を指定することができますが、使用するポートは一つだけに絞ることが推奨されています。

port_range = 49164-49164

また、適切なポートのポートフォワーディングが有効になっていることを確認してください (参照: Port Forward guides)。

その他の設定

encryption オプションは暗号化を有効化または無効化します。このオプションは、あなた自身だけのためではなく、torrent スウォームのピアのためでもあります。たとえセキュリティを上げる必要がなかったとしても、有効にすることに害はありません。

encryption = allow_incoming,try_outgoing,enable_retry

また、全ての接続で強制的に暗号化を使用することもできます。ただし、あまり厳しいルールを使用するとクライアントの可用性が減少していきます:

encryption = require,require_RC4,allow_incoming,try_outgoing

Wikipedia:BitTorrent Protocol Encryption も見て下さい。

最後に、dht オプションは DHT のサポートを有効にします。DHT は主要なトラッカーで使われており、クライアントがより多くのピアを獲得できるようになります。

dht = auto
dht_port = 6881
peer_exchange = yes

キーバインディング

rTorrent では専らキーボードショートカットを使って操作を行います。下のクイックレファレンスを参照してください。完全なガイドは rTorrent wiki にあります (参照: rTorrent User Guide)。

ノート: Striking Ctrl-q twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.
コマンド 操作
Ctrl-q アプリケーションを終了
Ctrl-s ダウンロードを開始。ハッシュが行われていない場合は先に実行
Ctrl-d ダウンロードを停止または停止したダウンロードを削除
Ctrl-k ファイルのダウンロードを停止して終了
Ctrl-r torrent のハッシュチェックを開始。ダウンロード/アップロードは行わない。
Left 前の画面に戻る
Right 次の画面に移る
Backspace/Return 指定した *.torrent を追加
a|s|d 全体のアップロード速度を 1|5|50 KB/s 間隔で増やす
A|S|D 全体のダウンロード速度を 1|5|50 KB/s 間隔で増やす
z|x|c 全体のアップロード速度を 1|5|50 KB/s 間隔で減らす
Z|X|C 全体のダウンロード速度を 1|5|50 KB/s 間隔で減らす

マッピングの重複

Ctrl-s は画面の出力の停止に、Ctrl-q は画面の出力の開始に使われるのがターミナルでは普通です。これらのマッピングが rTorrent と干渉してしまうことがあります。ターミナルのオプションがマッピングと関連付けられていないか確認してください:

$ stty -a
...
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
...

マッピングを削除するには、ターミナルの特性を変更して前述の特殊文字列を定義します (つまり stopstart):

# stty stop undef
# stty start undef

前述のコマンドを ~/.bashrc ファイルに追加することで、起動時に自動的にマッピングを削除させることができます。

ヒントとテクニック‎

tmux や screen を使用する systemd サービスファイル

  • tmux を使用 (rtorrent がクラッシュした場合に再起動)
/etc/systemd/user/rt.service
[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t rt:rtorrent.0 C-q && while pidof rtorrent > /dev/null; do sleep 0.5; echo rtorrent still running...; done"
WorkingDirectory=%h
Restart=on-failure

[Install]
WantedBy=default.target
  • rtorrent ユーザーで実行した tmux を使用 (rtorrent がクラッシュした場合に再起動)
/etc/systemd/system/rtorrent.service
[Unit]
Description=rTorrent Daemon
After=network.target

[Service]
Type=forking
KillMode=none
User=rtorrent
ExecStart=/usr/bin/tmux new-session -c /mnt/storage/rtorrent -s rtorrent -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rtorrent C-q && /usr/bin/tmux kill-session -t rtorrent
WorkingDirectory=/home/rtorrent/
Restart=on-failure

[Install]
WantedBy=multi-user.target
  • screen を使用
/etc/systemd/user/rt.service
[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=%h

[Install]
WantedBy=default.target

ブート時に起動:

$ systemctl --user enable rt

手動で起動:

$ systemctl --user start rt

停止:

$ systemctl --user stop rt

rtorrent のセッションにアタッチ:

tmux attach -t rt

デタッチ:

Ctrl-b d

事前割り当て

community リポジトリに入っている rTorrent パッケージは事前割り当ての機能が削られています。事前割り当てを有効にして rTorrent をコンパイルすることで、torrent をダウンロードする前にファイルを割り当てることが可能になります。ファイルシステムのフラグメント化を防ぐことができるという利点がありますが、ファイルシステムが fallocate システムコールをサポートしてないかった場合、事前割り当てで遅延が発生することになります。

したがって、ネイティブで fallocate をサポートしている xfs, ext4, btrfs ファイルシステムを使用する場合は、このスイッチを利用することを推奨します。これらのファイルシステムでは事前割り当てで遅延が発生することなく、ファイルシステムのフラグメンテーションを少なくします。他のファイルシステムで事前割り当てを有効にすると遅延が発生します。ただし、ファイルのフラグメント化は防げます。

事前割り当てを利用できるようには、ABS ツリーから以下のスイッチを使って libTorrent をリコンパイルしてください:

$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate

有効化するには、以下を ~/rtorrent.rc に追加します:

~/rtorrent.rc
# Preallocate files; reduces defragmentation on filesystems.
system.file_allocate.set = yes

完了したファイルの管理

ノート:
  • Currently, this part requires either the git version of rtorrent/libtorrent or having applied the patch to 0.8.6 that adds 'equal'.
  • If you're having trouble with this tip, it's probably easier to follow this.

It is possible to have rtorrent sort completed torrent data to specific folders based on which 'watch' folder you drop the *.torrent into while continuing to seed. Many examples show how to do this with torrents downloaded by rtorrent. The problem is when you try to drop in 100% done torrent data and then have rtorrent check the data and resume, it will not be sorted.

As a solution, use the following example in your ~/.rtorrent.rc. Make sure to change the paths.

# location where new torrent data is placed, and where you should place your
# 'complete' data before you place your *.torrent file into the watch folder
directory = /home/user/torrents/incomplete

# schedule a timer event named 'watch_directory_1':
# 1) triggers 10 seconds after rtorrent starts
# 2) triggers at 10 second intervals thereafter
# 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/
# 4) set a variable named 'custom1' with the value "/home/user/torrents/complete"
# NOTE: if you do not want it to automatically start the torrent, change 'load_start' to 'load'
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"

# insert a method with the alias 'checkdirs1'
# 1) returns true if the current path of the torrent data is not equal to the value of custom1
# 2) otherwise, returns false
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""

# insert a method with the alias 'movecheck1'
# 1) returns true if all 3 commands return true ('result of checkdirs1' && 'torrent is 100% done', 'custom1 variable is set')
# 2) otherwise, returns false
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"

# insert a method with the alias 'movedir1'
# (a series of commands, separated by ';') 
# 1) "set path of torrent to equal the value of custom1";
# 2) "mv -u <current data path> <custom1 path>";
# 3) "clear custom1", "stop the torrent","resume the torrent"
# 4) stop the torrent
# 5) start the torrent (to get the torrent to update the 'base path')
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="

# set a key with the name 'move_hashed1' that is triggered by the hash_done event.
# 1) When hashing of a torrent completes, this custom key will be triggered.
# 2) when triggered, execute the 'movecheck1' method and check the return value.
# 3) if the 'movecheck' method returns 'true', execute the 'movedir1' method we inserted above.
# NOTE-0: *Only* data that has had their hash checked manually with ^R [^R = Control r].
# Or on a rtorrent restart[which initiates a hash check]. Will the data move; ~/torrents/incomplete => ~/torrents/complete for example.
# NOTE-1: 'branch' is an 'if' conditional statement: if(movecheck1){movedir1}
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"

You can add additional watch folders and rules should you like to sort your torrents into special folders.

For example, if you would like the torrents to download in:

/home/user/torrents/incomplete

and then sort the torrent data based on which folder you dropped the *.torrent into:

/home/user/torrents/watch => /home/user/torrents/complete
/home/user/torrents/watch/iso => /home/user/torrents/complete/iso
/home/user/torrents/watch/music => /home/user/torrents/complete/music

You can have the following in your .rtorrent.rc:

directory = /home/user/torrents/incomplete
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"

schedule = watch_directory_2,10,10,"load_start=/home/user/torrents/watch/iso/*.torrent,d.set_custom1=/home/user/torrents/complete/iso"

schedule = watch_directory_3,10,10,"load_start=/home/user/torrents/watch/music/*.torrent,d.set_custom1=/home/user/torrents/complete/music"

system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_custom1=;d.set_custom1=;d.stop=;d.start="
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"

Also see pyroscope especially the rtcontrol examples. There is an AUR package.

Google メールで通知

Cell phone providers allow you to "email" your phone:

Verizon: 10digitphonenumber@vtext.com
AT&T: 10digitphonenumber@txt.att.net
Former AT&T customers: 10digitphonenumber@mmode.com
Sprint: 10digitphonenumber@messaging.sprintpcs.com
T-Mobile: 10digitphonenumber@tmomail.net
Nextel: 10digitphonenumber@messaging.nextel.com
Cingular: 10digitphonenumber@cingularme.com
Virgin Mobile: 10digitphonenumber@vmobl.com
Alltel: 10digitphonenumber@alltelmessage.com OR
10digitphonenumber@message.alltel.com
CellularOne: 10digitphonenumber@mobile.celloneusa.com
Omnipoint: 10digitphonenumber@omnipointpcs.com
Qwest: 10digitphonenumber@qwestmp.com
Telus: 10digitphonenumber@msg.telus.com
Rogers Wireless: 10digitphonenumber@pcs.rogers.com
Fido: 10digitphonenumber@fido.ca
Bell Mobility: 10digitphonenumber@txt.bell.ca
Koodo Mobile: 10digitphonenumber@msg.koodomobile.com
MTS: 10digitphonenumber@text.mtsmobility.com
President's Choice: 10digitphonenumber@txt.bell.ca
Sasktel: 10digitphonenumber@sms.sasktel.com
Solo: 10digitphonenumber@txt.bell.ca
  • /etc/mail.rc ファイルを消去して以下を入力:
set sendmail="/usr/bin/mailx"
set smtp=smtp.gmail.com:587
set smtp-use-starttls
set ssl-verify=ignore
set ssl-auth=login
set smtp-auth-user=USERNAME@gmail.com
set smtp-auth-password=PASSWORD

テキストを送信するために、メッセージを mailx プログラムにパイプします。

  • Bash スクリプトを作成:
/path/to/mail.sh
echo "$@: Done" | mailx 5551234567@vtext.com

Where the $@ is a variable holding all the arguments passed to our script.

  • And finally, add the important ~/.rtorrent.rc line:
system.method.set_key = event.download.finished,notify_me,"execute=/path/to/mail.sh,$d.get_name="

Breaking it down:

notify_me is the command id, which may be used by other commands, it can be just about anything you like, so long as it is unique.

execute= is the rtorrent command, in this case to execute a shell command.

/path/to/mail.sh is the name of our script (or whatever command you want to execute) followed by a comma separated list of all the switches/arguments to be passed.

$d.get_name= 'd' is an alias to whatever download triggered the command, get_name is a function which returns the name of our download, and the '$' tells rTorrent to replace the command with its output before it calls execute.

The end result? When that torrent, 'All Live Nudibranches', that we started before leaving for work finishes, we will be texted:

All Live Nudibranches: Done

アクティブな torrent を表示

デフォルトでは rtorrent はアクティブなタブを正しく表示しません。アクティブな torrent だけを表示するには .rtorrent.rc に以下の行を追加してください:

schedule = filter_active,30,30,"view_filter = active,\"or={d.get_up_rate=,d.get_down_rate=}\""

rTorrent クライアントで 9 押すと動作の変更が確認できます。

手動でトラッカーを torrent に追加

  1. rTorrent のコンソールビューから編集する torrent を選択。
  2. Ctrl+x を押す。
  3. If you had four trackers type following lines one at a time (always press Ctrl+x first) to add four more for example:
d.tracker.insert="5","udp://tracker.publicbt.com:80"
d.tracker.insert="6","udp://tracker.openbittorrent.com:80"
d.tracker.insert="7","udp://tracker.istole.it:80"
d.tracker.insert="8","udp://tracker.ccc.de:80"

トラブルシューティング

CA 証明書

rTorrent で HTTPS を使用するトラッカーを使う場合、root で以下を実行してください:

# cd /etc/ssl/certs
# wget --no-check-certificate https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer
# mv Equifax_Secure_Global_eBusiness_CA-1.cer Equifax_Secure_Global_eBusiness_CA-1.pem
# c_rehash

そして rTorrent を次のコマンドで実行してください:

$ rtorrent -o http_capath=/etc/ssl/certs

GNU Screen を使っている場合、変更が適用されるように .screenrc 設定ファイルを更新:

$ screen -t rtorrent rtorrent -o http_capath=/etc/ssl/certs

rTorrent 0.8.9 では network.http.ssl_verify_peer.set=0 を設定することで 問題が修正 されます。

詳細は次を参照: rTorrent Error & CA CertificaterTorrent Certificates Problem

ディレクトリのロック

クラッシュや不正のシャットダウンの後、ときどき rTorrent が動かなくなって、ロックファイルについてエラーを表示することがあります。

Per the error message, the file called "rtorrent.lock" can be found within the hidden folder .rtorrentsession for your download directory and manually removed.

Event failed: bad return code

system.method.* の行に空白が入っているのが原因です。空白を削除すれば動作するようになります。

ウェブインターフェイス

rTorrent には様々なウェブインターフェイスやフロントエンドが存在しています:

  • WTorrent は PHP ライブラリの Smarty テンプレートと XMLRPC を使って PHP でプログラミングされた rtorrent のウェブインターフェイスです。
  • nTorrent は rtorrent (cli torrent クライアント) の Java で書かれたグラフィカルユーザーインターフェイスです。
  • rTWi は PHP で書かれたシンプルな rTorrent ウェブインターフェイスです。
  • Rtgui は PHP で書かれたウェブベースの rTorrent フロントエンドで、XML-RPC を使って rTorrent クライアントと対話します。
  • rutorrentForum - uTorrent とよく似たインターフェイスを持つウェブベースのフロントエンドです。多数のプラグインと高度な機能をサポートしています (参照: ruTorrentGuide on forum)。
ノート: rTorrent is currently built using XML-RPC for C/C++, which is required for some web interfaces (e.g. ruTorrent).

XMLRPC インターフェイス

rtorrent をウェブインターフェイス (例: rutorrent) で使いたい場合は設定ファイルに以下の行を追加してください:

scgi_port = localhost:5000

詳細は次を参照: Using XMLRPC with rtorrent

マグネットリンクを watch フォルダに torrent ファイルとして保存

ノート: Rtorrent はネイティブでマグネットリンクによる torrent のダウンロードに対応しています。(Rtorrent を起動して 1 を押すと表示される) メインビューで、エンターを押してください。"load.normal>" にマグネットリンクを貼り付けてエンターを再度押すとダウンロードが開始されます。

マグネットリンクを watch フォルダに自動的に追加したい場合、以下のスクリプトで行うことができます:

#!/bin/bash
watch_folder=~/.rtorrent/watch
cd $watch_folder
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"

(ソース: http://blog.gonzih.org/blog/2012/02/17/how-to-use-magnet-links-with-rtorrent/)

Save it, for instance as rtorrent-magnet, give it execution permission, and place it somewhere under your $PATH. Then in Firefox:

  1. Type about:config into the Location Bar (address bar) and press Enter.
  2. Right-click: New > Boolean > Name: network.protocol-handler.expose.magnet > Value > false.
  3. Next time you click a magnet link you will be asked which application to open it with. Select the script we just created and you'll be done.

If you want xdg-open to handle this, which you need if you're using chrome instead of firefox, (though gnome and other DE might have their own programs overriding xdg-open) you need to create the desktop entry for the rtorrent-magnet script in ~/.local/share/applications/rtorrent-magnet.desktop with the following content:

[Desktop Entry]
Type=Application
Name=rtorrent-magnet
Exec=rtorrent-magnet %U
MimeType=x-scheme-handler/magnet;
NoDisplay=true

Then all you need to do is to register the mimetype using:

$ xdg-mime default rtorrent-magnet.desktop x-scheme-handler/magnet

マグネットを Torrent に変換

magnet2torrent-gitAUR パッケージを使うことでメタデータをダウンロードして torrent ファイルを作成することができます。

使用方法:

$ magnet2torrent <magnet link> [torrent file]

rtorrent-pyro

AURrtorrent-pyroAUR[リンク切れ: アーカイブ: aur-mirror] には rtorrent のコンソールインターフェイスが付属しています。pyroscope ツールは含まれていません。pyroscope ツールも必要な場合は #PyroScope を見て下さい。

Make sure you add following command to ~/.rtorrent.rc, which makes the asterisk key * to a shortcut for toggling between extended and collapsed view within rtorrent's interface:

schedule = bind_collapse,0,0,"ui.bind_key=download_list,*,view.collapsed.toggle="

Also set "pyro.extended" to 1 to activate rTorrent-PS features.

system.method.insert = pyro.extended, value|const, 1

PyroScope

pyroscope のインストール用のディレクトリを作成して、subversion からソースコードをダウンロード・アップデート:

mkdir -p ~/.lib
svn checkout http://pyroscope.googlecode.com/svn/trunk/ ~/.lib/pyroscope
~/.lib/pyroscope/update-to-head.sh

pyroscope のバイナリを .bashrc の PATH に追加:

export PATH=$PATH:path_to_the_bin      # Example path for pyroscope bin's: /home/user/.lib/pyroscope/bin/

~/.pyroscope/config.ini を作成:

pyroadmin --create-config

Add this to your ~/.rtorrent.rc. Don't forget to add the path of your pyroscope bin's dir (see below).

system.method.insert = pyro.bin_dir, string|const, write_here_path_to_your_pyroscope_bin_dir     # Example path: /home/user/.lib/pyroscope/bin/
system.method.insert = pyro.rc_dialect, string|const|simple, "execute_capture=bash,-c,\"test $1 = 0.8.6 && echo -n 0.8.6 || echo -n 0.8.9\",dialect,$system.client_version="
system.method.insert = pyro.rtorrent_rc, string|const|private, "$cat=~/.pyroscope/rtorrent-,\"$pyro.rc_dialect=\",.rc.default"
import = $pyro.rtorrent_rc=

Optionally: TORQUE: Daemon watchdog schedule. Must be activated by touching the "~/.pyroscope/run/pyrotorque" file! You can also just use rtorrent watch dir or give pyro_watchdog a try, which comes with 'treewatch' ability, meaning it also watches for torrents recursively within the given watch path. Further documentation for pyro_watchdog is here: [1] To enable pyro_watchdog, add this in ~/.rtorrent.rc and further configurations are in ~/.pyroscope/torque.ini.

schedule = pyro_watchdog,30,300,"pyro.watchdog=~/.pyroscope,-v"

Following steps are important. Before using pyroscope tools you have to set the missing "loaded" times to that of the .torrent file. Run this in your terminal:

rtcontrol '!*"*' loaded=0 -q -sname -o 'echo "$(name)s"\ntest -f "$(metafile)s" && rtxmlrpc -q d.set_custom $(hash)s tm_loaded \$(\
    ls -l --time-style "+%%s" "$(metafile)s" \
    | cut -f6 -d" ")\nrtxmlrpc -q d.save_session $(hash)s' | bash

And now set the missing "completed" times to that of the data file or directory:

rtcontrol '!*"*' completed=0 done=100 path=\! is_ghost=no -q -sname -o 'echo "$(name)s"\ntest -e "$(realpath)s" && rtxmlrpc -q d.set_custom $(hash)s tm_completed \$(\
    ls -ld --time-style "+%%s" "$(realpath)s" \
    | cut -f6 -d" ")\nrtxmlrpc -q d.save_session $(hash)s' | bash

Example usage: Will print out all torrents older than 2 hours:

rtcontrol -V completed=+2h -scompleted -ocompleted

Deletes all torrents older than 48 hours:

rtcontrol -V completed=+48h -scompleted -ocompleted --cull --yes

参照

フォーラムスレッド