「RTorrent」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(他言語へのリンクを修正)
 
(3人の利用者による、間の37版が非表示)
1行目: 1行目:
 
{{DISPLAYTITLE:rTorrent}}
 
{{DISPLAYTITLE:rTorrent}}
[[Category:インターネットアプリケーション]]
+
[[Category:BitTorrent]]
 
[[en:RTorrent]]
 
[[en:RTorrent]]
[[es:RTorrent]]
+
[[zh-hans:RTorrent]]
[[ru:RTorrent]]
 
[[zh-CN: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 クライアント]]として活用できます。
   
 
== インストール ==
 
== インストール ==
   
[[公式リポジトリ]]の {{Pkg|rtorrent}} パッケージを[[インストール]]してください。
+
[[公式リポジトリ]]の {{Pkg|rtorrent}} パッケージを [[インストール]] してください。
   
  +
=== 非公式パッケージ ===
もしくは、[[AUR]] から {{AUR|rtorrent-git}} か {{AUR|rtorrent-extended}} をインストールしてください。
 
  +
  +
* {{AUR|rtorrent-git}} - Git [https://github.com/rakshasa/rtorrent main branch] パッケージ
  +
* {{AUR|rtorrent-ps}} - [https://github.com/pyroscope/rtorrent-ps rtorrent-ps patchset] ps パッチセットを含むリリースパッケージ
  +
* {{AUR|rtorrent-pyro-git}} - Git [https://github.com/rakshasa/rtorrent/tree/feature-bind feature-bind branch] を含む [https://github.com/pyroscope/rtorrent-ps rtorrent-ps patchset] パッケージ
  +
* {{AUR|rtorrent-vi-color}} - vi のようなキーバインディングを備えたリリースパッケージ
   
 
== 設定 ==
 
== 設定 ==
   
{{Note|設定に関する詳細は次の rTorrent wiki の記事を見て下さい: [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行目: 26行目:
 
=== パフォーマンス ===
 
=== パフォーマンス ===
   
{{Note|パフォーマンスに関する詳細は次の rTorrent wiki の記事を見て下さい: [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]
85行目: 88行目:
 
rTorrent では専らキーボードショートカットを使って操作を行います。下のクイックレファレンスを参照してください。完全なガイドは rTorrent wiki にあります (参照: [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|{{ic|Ctrl-q}} を 2 回連続で押すと、接続中のトラッカーへの停止アナウンスの送信を待たずに rTorrent がシャットダウンします。}}
{{Note|Striking {{ic|Ctrl-q}} twice in quick succession will make rTorrent shutdown without waiting to send a stop announce to the connected trackers.}}
 
   
 
{| class="wikitable"
 
{| class="wikitable"
131行目: 134行目:
 
=== マッピングの重複 ===
 
=== マッピングの重複 ===
   
  +
{{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行目: 140行目:
 
</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 サービスファイル ===
+
=== ヘッドレスサーバのための Systemd サービス ===
   
  +
このユニット ファイルは、rtorrent という 1 人のユーザーの実行と、rtorrent がデーモンとして実行されるように設定することに依存しています。
*tmux を使用
 
   
  +
次のファイルを作成します。
{{hc|/etc/systemd/system/rt@.service|<nowiki>
 
  +
{{hc|/etc/systemd/system/rtorrent.service|<nowiki>>
  +
[Unit]
  +
Description=rTorrent System Daemon
  +
After=network.target
  +
  +
[Service]
  +
Type=simple
  +
User=rtorrent
  +
Group=rtorrent
  +
# Modify the next 2 lines to use absolute paths
  +
ExecStartPre=-/bin/rm -f /<home>/.session/rtorrent.lock
  +
ExecStart=/usr/bin/rtorrent -o import=/<home>/rtorrent.rc
  +
Restart=on-failure
  +
RestartSec=3
  +
  +
[Install]
  +
WantedBy=multi-user.target
  +
</nowiki>}}
  +
  +
=== ユーザーのためのデーモンとしての Systemd サービス ===
  +
  +
このユニットでは、複数のユーザー、または 1 人のユーザーが rtorrent をデーモンとして実行できるようにします。
  +
  +
ブート時に rtorrent を起動するには、[[有効]] {{ic|rtorrent@''user''}} ({{ic|''user''}} は rtorrent を実行するユーザー) を指定します。
  +
  +
以下のファイルを作成します。
  +
  +
{{hc|/etc/systemd/system/rtorrent@.service|2=
  +
[Unit]
  +
Description=rTorrent for %i
  +
After=network.target
  +
  +
[Service]
  +
Type=simple
  +
User=%i
  +
Group=%i
  +
WorkingDirectory=/home/%i
  +
# Modify the next line to the absolute path for rtorrent.lock, for example
  +
ExecStartPre=-/bin/rm -f /home/%i/.session/rtorrent.lock
  +
ExecStart=/usr/bin/rtorrent -o system.daemon.set=true
  +
Restart=on-failure
  +
RestartSec=3
  +
  +
[Install]
  +
WantedBy=multi-user.target
  +
}}
  +
  +
=== tmux や screen を使った Systemd サービス ===
  +
  +
以下のサービスは、サービスユニットの種類によって使用方法が異なります。
  +
  +
'''システムサービスの場合'''(/etc/systemd/system/ の中)
  +
  +
ブート時に起動させる:
  +
# systemctl enable rtorrent
  +
手動で起動:
  +
# systemctl start rtorrent
  +
ストップ:
  +
# systemctl stop rtorrent
  +
  +
''rtorrent'' ユーザーが適切なホーム ディレクトリに作成され、rtorrent.rc が配置されていることを確認します。
  +
  +
'''ユーザーサービス''' (/etc/systemd/user/ の中):
  +
$ systemctl --user enable rtorrent
  +
手動で起動:
  +
$ systemctl --user start rtorrent
  +
ストップ:
  +
$ systemctl --user stop rtorrent
  +
  +
==== screen を使用 ====
  +
  +
*システム・サービス・ユニットとして
  +
  +
{{hc|/etc/systemd/system/rtorrent.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
+
User=rtorrent
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
+
ExecStartPre=/usr/bin/bash -c "if test -e %h/.rtorrent_session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f %h/.rtorrent_session/rtorrent.lock; fi"
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
+
ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent
  +
ExecStop=/usr/bin/bash -c "test `pidof rtorrent` && killall -w -s 2 /usr/bin/rtorrent"
WorkingDirectory=/home/%I/
 
  +
WorkingDirectory=%h
  +
Restart=on-failure
   
 
[Install]
 
[Install]
167行目: 245行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
*ユーザーサービスユニットとして
*tmux を使用 (rtorrent がクラッシュした場合に再起動)
 
  +
{{hc|/etc/systemd/system/rt@.service|<nowiki>
 
  +
{{hc|/etc/systemd/user/rtorrent.service|<nowiki>
 
[Unit]
 
[Unit]
 
Description=rTorrent
 
Description=rTorrent
Requires=network.target local-fs.target
+
After=network.target
   
 
[Service]
 
[Service]
 
Type=forking
 
Type=forking
 
KillMode=none
 
KillMode=none
  +
ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent
User=%I
 
  +
ExecStop=/usr/bin/killall -w -sユーザーのためのデーモンとしての Systemd サービス 2 /usr/bin/rtorrent
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
 
  +
WorkingDirectory=%h
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
 
  +
WorkingDirectory=/home/%I/
 
  +
[Install]
  +
WantedBy=default.target
  +
</nowiki>}}
  +
  +
rtorrent のセッションにアタッチします。
  +
screen -D -r rtorrent
  +
  +
==== tmux を使用 ====
  +
  +
*独立した tmux サーバー付き (クラッシュした場合は rtorrent を再起動)
  +
  +
{{hc|~/.config/systemd/user/rtorrent.service|<nowiki>
  +
[Unit]
  +
Description=rtorrent
  +
After=network.target
  +
  +
[Service]
  +
Type=forking
  +
ExecStartPre=/usr/bin/bash -c "if test -e ~/.session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f ~/.session/rtorrent.lock; fi"
  +
ExecStart=/usr/bin/tmux -L rt new-session -s rt -n rtorrent -d rtorrent
  +
ExecStop=/usr/bin/bash -c "/usr/bin/tmux -L rt send-keys -t rt:rtorrent.0 C-q; while pidof rtorrent > /dev/null; do echo stopping rtorrent...; sleep 1; done"
 
Restart=on-failure
 
Restart=on-failure
   
 
[Install]
 
[Install]
WantedBy=multi-user.target
+
WantedBy=default.target
 
</nowiki>}}
 
</nowiki>}}
   
  +
*tmux をユーザー rtorrent として実行した場合 (クラッシュした場合は 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]
197行目: 298行目:
 
User=rtorrent
 
User=rtorrent
 
ExecStart=/usr/bin/tmux new-session -c /mnt/storage/rtorrent -s rtorrent -n rtorrent -d 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
+
ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done"
WorkingDirectory=/home/rtorrent/
+
WorkingDirectory=%h
 
Restart=on-failure
 
Restart=on-failure
   
205行目: 306行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
rtorrent のセッションにアタッチ:
*screen を使用
 
  +
tmux -L rt attach -t rt
  +
tmux attach -t rt
  +
  +
デタッチ:
  +
Ctrl-b d
  +
  +
=== dtach を使った systemd サービスファイル ===
  +
  +
systemd 単位で dtach を実行する場合、rtorrent が動作するためには [[systemd/ユーザー#環境変数|環境変数]] が明示的に設定されている必要があります。
  +
  +
このサービス ファイルには再起動がありません。これは、作者が問題のドライブをオフラインにすることがあり、このシナリオで起動すると rtorrent が失敗し、各トレントを格納する特定のディレクトリなど、多くのトレント固有の設定が失われるためです (''最適化されていない'' と言うべきでしょうか) 実際、rtorrent を起動するシンボリック リンクは、関連ドライブに存在します。 rtorrent の起動をブロックするこの使用例は、NAS、USB、eSATA ドライブなどのリムーバブル メディアにダウンロードしたファイルを置くユーザーに関連するものです。
   
{{hc|/etc/systemd/system/rt@.service|<nowiki>
+
{{hc|~/.config/systemd/user/rtorrent.service|<nowiki>
 
[Unit]
 
[Unit]
 
Description=rTorrent
 
Description=rTorrent
Requires=network.target local-fs.target
+
#After=network.target
   
 
[Service]
 
[Service]
  +
# set TERM according to your terminal
  +
Environment="TERM=xterm"
  +
#Environment="TERM=linux"
 
Type=forking
 
Type=forking
RemainAfterExit=yes
 
 
KillMode=none
 
KillMode=none
  +
ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /home/sam/bin/rtr_new -n -o import=/home/sam/.config/rtorrent/new_.rc
User=%I
 
  +
# dtach -n <separate filename for each instance>
ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent
 
  +
#
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
 
  +
# rtr_new -n to ignore the default .rtorrent.rc
WorkingDirectory=/home/%I/
 
  +
# rtr_new -o import to load the instance-specific rc
  +
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new
   
 
[Install]
 
[Install]
225行目: 341行目:
 
</nowiki>}}
 
</nowiki>}}
   
  +
このサービスファイルには、dtach 以外にもいくつかの問題があることに注意してください。
ブート時に起動:
 
# systemctl enable rt@$USER
 
手動で起動:
 
# systemctl start rt@$USER
 
停止:
 
# systemctl stop rt@$USER
 
rtorrent のセッションにアタッチ:
 
tmux attach -t rt
 
デタッチ:
 
Ctrl-b d
 
   
  +
{{ic|/home/sam/bin/rtr_new}} is a symlink to {{ic|/usr/bin/rtorrent}}
=== 事前割り当て ===
 
   
  +
これにより、複数のインスタンスを実行し、それぞれを異なるバージョンの ExecStop で個別に終了させることができます。
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.
 
   
  +
{{bc|1=ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new
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.
 
  +
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_academic
  +
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_other_stuff}}
   
  +
これらはそれぞれ別のサービスファイル内にあり、それぞれが1つのインスタンスを制御します。
To make pre-allocation available, recompile libTorrent from the [[ABS]] tree with the following new switch:
 
  +
$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate
 
  +
このステップを実行しないと、複数のインスタンスを実行している場合、killall ソリューションにより実行中のすべての rtorrent インスタンスが削除されます。
  +
  +
複数の rtorrent インスタンスが不要で、rtorrent rc ファイルがデフォルトの場所にある場合、上記のサービス ファイルを簡略化することができます。 ファイル全体が含まれますが、ExecStart と
  +
ExecStop の行が変わります。
  +
  +
{{hc|~/.config/systemd/user/rtorrent.service|<nowiki>
  +
[Unit]
  +
Description=rTorrent
  +
#After=network.target
  +
  +
[Service]
  +
# set TERM according to your terminal
  +
Environment="TERM=xterm"
  +
#Environment="TERM=linux"
  +
# Type=forking is not required if ExecStart command is run using dtach -N (i.e dtach will run on foreground).
  +
Type=forking
  +
KillMode=none
  +
ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /usr/bin/rtorrent
  +
# dtach -n <user specified FIFO name> -e <user specified character> /usr/bin/rtorrent
  +
ExecStop=/usr/bin/killall -w -s INT /usr/bin/rtorrent
  +
# -e (exact match) and -u (user name) were added above to stop specific processes
  +
# and may be omitted here because only one rtorrent will be running
  +
  +
[Install]
  +
WantedBy=multi-user.target
  +
</nowiki>}}
  +
  +
ExecStart=-/usr/bin/dtach` の部分にあるハイフンに注意してください。これは、失敗の終了コードも成功の終了を表すことができるようにするためです。これは現在の問題 [https://github.com/crigler/dtach/issues/12] のためと思われます。代替案としては、サービスセクションで `SuccessExitStatus=1` を使用することです。
  +
  +
このサービスは [[systemctl --user]] で制御することができます。起動したら、セッションにアタッチすることができます。
  +
  +
$ dtach -a /home/sam/run/dtach_fifos/fifo -e "^T".
  +
  +
=== 事前割り当て ===
  +
  +
rTorrent には、トレント用の領域を事前に割り当てる機能があります。主な利点は、ファイル システムの断片化を制限および回避できることです。ただし、ファイルシステムが fallocate システムコールをネイティブでサポートしていない場合、事前割り当て時に遅延が発生します。
  +
  +
したがって、このスイッチは、fallocate システムコールをネイティブでサポートしている xfs、ext4、btrfs、および ocfs2 ファイルシステムに推奨されます。これらのファイルシステムでは、事前割り当て時の遅延がなく、ファイルシステムが断片化することもありません。他のファイルシステムでの事前割り当ては、遅延は発生しますが、ファイルの断片化は起こりません。
   
  +
これを有効にするには:
To enable it, add the following to your {{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 = 1
 
</nowiki>}}
 
</nowiki>}}
  +
  +
上記以外のファイルシステムでプリアロケーションを利用できるようにするには、(遅れはあるものの)次の新しいスイッチを使用して、[[ABS]] ツリーから libTorrent を再コンパイルすることで可能です。
  +
$ ./configure --prefix=/usr --disable-debug --with-posix-fallocate
  +
  +
参照 [https://github.com/rakshasa/rtorrent/wiki/Performance-Tuning#disk-allocation the upstream documentation for further information]
   
 
=== 完了したファイルの管理 ===
 
=== 完了したファイルの管理 ===
   
  +
==== ウォッチフォルダあり ====
{{Note|
 
*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].
 
}}
 
   
  +
{{Note|このヒントで困っている場合、こちらも参照して見て下さい。[https://github.com/rakshasa/rtorrent/wiki/Common-Tasks-in-rTorrent#move-completed-torrents-to-a-fixed-location docs]}}
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.
 
   
  +
rtorrent は、シードを継続しながら、*.torrent をどの ''ウォッチ'' フォルダにドロップしたかに基づいて、完了したトレント データを特定のフォルダに整理することができます。
As a solution, use the following example in your {{ic|~/.rtorrent.rc}}.
 
  +
Make sure to change the paths.
 
  +
解決策として、{{ic|~/.rtorrent.rc}} で次の例を使用してください。必ずパスを変更してください。
   
 
{{bc|1=
 
{{bc|1=
  +
# default path for in progress downloads
# 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
 
directory = /home/user/torrents/incomplete
   
273行目: 422行目:
 
# 3) Upon trigger, attempt to load (and start) new *.torrent files found in /home/user/torrents/watch/
 
# 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"
 
# 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'
+
# NOTE: if you do not want it to automatically start the torrent, change 'load.start' to 'load.normal'
schedule = watch_directory_1,10,10,"load_start=/home/user/torrents/watch/*.torrent,d.set_custom1=/home/user/torrents/complete"
+
schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete"
   
  +
# upon completion, move content to path specified above via custom1
# insert a method with the alias 'checkdirs1'
 
  +
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
# 1) returns true if the current path of the torrent data is not equal to the value of custom1
 
  +
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
# 2) otherwise, returns false
 
  +
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
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=}"
 
   
  +
{{bc|1=
# insert a method with the alias 'movedir1'
 
  +
directory = /home/user/torrents/incomplete
# (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="
 
   
  +
schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete"
# set a key with the name 'move_hashed1' that is triggered by the hash_done event.
 
  +
schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.custom1.set=/home/user/torrents/complete/iso"
# 1) When hashing of a torrent completes, this custom key will be triggered.
 
  +
schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.custom1.set=/home/user/torrents/complete/music"
# 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=}"
 
}}
 
   
  +
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
You can add additional watch folders and rules should you like to sort your torrents into special folders.
 
  +
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
  +
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
  +
}}
   
  +
また、ウォッチディレクトリごとに不完全なディレクトリを指定することも可能です:
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:
 
 
{{bc|1=
 
{{bc|1=
 
directory = /home/user/torrents/incomplete
 
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"
+
schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.directory.set=/home/user/torrents/incomplete,d.custom1.set=/home/user/torrents/complete"
  +
schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.directory.set=/home/user/torrents/incomplete/iso,d.custom1.set=/home/user/torrents/complete/iso"
  +
schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.directory.set=/home/user/torrents/incomplete/music,d.custom1.set=/home/user/torrents/complete/music"
   
  +
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
schedule = watch_directory_3,10,10,"load_start=/home/user/torrents/watch/music/*.torrent,d.set_custom1=/home/user/torrents/complete/music"
 
  +
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
 
  +
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="
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=}"
 
 
}}
 
}}
   
  +
また、[https://rtorrent-docs.readthedocs.io/en/latest/use-cases.html#versatile-move-on-completion bash スクリプトによる補完移動]、[https://pyrocore.readthedocs.io/en/latest/howto.html#moving-all-data-for-selected-items-to-a-new-location pyrocore の rtcontrol] (AUR パッケージがあります) も参照してください。
Also see [http://code.google.com/p/pyroscope/ pyroscope] especially the rtcontrol examples. There is an AUR package.
 
  +
  +
==== ウォッチフォルダ無し ====
  +
  +
rtorrent が完成したフォルダーの場所をラベルごとに自動的に管理することを希望する場合は、以下を rtorrent.rc 構成に追加し、環境に合わせてパスを修正します:
  +
  +
{{bc|1=
  +
# Check if destination dir is not Null
  +
method.set_key = event.download.inserted_new,check_dest_dir, \
  +
"branch=d.custom=storagedir,,\
  +
\"d.custom.set=storagedir,/path/to/download/directory\""
  +
  +
# Modify destination dir according to tv label
  +
method.set_key = event.download.inserted_new,update_dest_dir_tv, \
  +
"branch=\"equal={d.custom1=, cat=TV}\",\
  +
\"d.custom.set=storagedir,/path/to/tv/dir\""
  +
  +
# Modify destination dir according to movies label
  +
method.set_key = event.download.inserted_new,update_dest_dir_movies, \
  +
"branch=\"equal={d.custom1=, cat=Movies}\",\
  +
\"d.custom.set=storagedir,/path/to/movie/dir\""
  +
  +
# Move files of completed torrents
  +
method.set_key = event.download.finished,move_completed, \
  +
"d.directory.set=$d.custom=storagedir; \
  +
execute2={mv,-u,$d.base_path=,$d.custom=storagedir}"}}
  +
  +
{{Note|さらにラベルを追加するには、2 番目または 3 番目の段落をコピーして、'TV' または 'Movies' の各インスタンスを新しいラベルに置き換えます。}}
  +
  +
このユースケースの例は、ZFS を使用していて、ソース素材を同じファイルシステム上に置く必要がある場合です。rTorrent は一時的な NVMe/SSD にダウンロードし、コンテンツを ZFS ファイルシステムに移動します。そこで *arrs がメディアを処理し、メディアサーバーがスクレイピングする別のフォルダーにハードリンクします。
  +
  +
==== Google メールでの通知 ====
   
==== Google メールで通知 ====
+
携帯電話に ''メール'' を送ることもきます。
   
Cell phone providers allow you to "email" your phone:
 
 
{{bc|<nowiki>
 
{{bc|<nowiki>
 
Verizon: 10digitphonenumber@vtext.com
 
Verizon: 10digitphonenumber@vtext.com
359行目: 519行目:
 
</nowiki>}}
 
</nowiki>}}
   
*[[公式リポジトリ]] {{Pkg|s-nail}} パッケージで mailx をインストールしてください
+
*[[公式リポジトリ]] にある {{Pkg|s-nail}} パッケージで提供されている mailx をインストールします
   
*Clear the {{ic|/etc/mail.rc}} file and enter:
+
*{{ic|/etc/mail.rc}} ファイルをクリアして、入力します。
   
 
{{bc|<nowiki>
 
{{bc|<nowiki>
373行目: 533行目:
 
</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
 
</nowiki>}}
 
</nowiki>}}
  +
ここで、$@ はスクリプトに渡されるすべての引数を保持する変数です。
Where the $@ is a variable holding all the arguments passed to our script.
 
  +
最後に、重要な ~/.rtorrent.rc 行を追加します。
 
  +
以下分解です:
*And finally, add the important {{ic|~/.rtorrent.rc}} line:
 
system.method.set_key = event.download.finished,notify_me,"execute=/path/to/mail.sh,$d.get_name="
 
   
  +
{{ic|notify_me}} はコマンドIDで、他のコマンドで使用される可能性があり、ユニークであれば何でもかまいません。
Breaking it down:
 
   
  +
{{ic|1=execute=}} は、rtorrent コマンドで、この場合はシェル コマンドを実行します。
{{ic|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.
 
   
  +
{{ic|/path/to/mail.sh}} は、スクリプトの名前 (または実行するコマンド) と、渡されるすべてのスイッチ/引数をカンマで区切ったリストです。
{{ic|1=execute=}} is the rtorrent command, in this case to execute a shell command.
 
   
  +
{{ic|1=$d.get_name=}} ''d'' はコマンドのトリガーとなるダウンロードのエイリアス、''get_name'' はダウンロードの名前を返す関数、''$'' は実行を呼び出す前にコマンドをその出力に置き換えるよう rTorrent に指示します。
{{ic|/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.
 
   
  +
最終結果は? 出勤前に開始したトレント、''All Live Nudibranches'' が終了すると、テキストが送信されます。
{{ic|1=$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
 
All Live Nudibranches: Done
   
=== ティブな torrent を表示 ===
+
=== UI トリック ===
  +
 
  +
rTorrent はデフォルトでアクティブなタブを正しく表示しません。アクティブなトレントのみを表示するには、次の行を {{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=}\""
+
schedule2 = filter_active,30,30,"view.filter = active,\"or={d.up.rate=,d.down.rate=}\""
   
  +
次に、rTorrent クライアントで {{ic|9}} を押して、変更点を確認します。
Then press {{ic|9}} in your rTorrent client to see the changes in action.
 
  +
  +
シードビューをアップロード率でソートし、ピアのいるトレントのみを表示するには。
  +
  +
# Sort the seeding view by the upload rate and only show torrents with peers
  +
view.sort_current = seeding,greater=d.up.rate=
  +
view.filter = seeding,"and=d.complete=,d.peers_connected="
  +
view.sort_new = seeding,less=d.up.rate=
  +
view.sort = seeding
  +
  +
完全なビューをアップロード率でソートする場合。
  +
  +
# Sort the complete view by the upload rate
  +
view.sort_current = complete,greater=d.up.rate=
  +
view.filter = seeding,"and=d.complete="
  +
view.sort_new = seeding,less=d.up.rate=
  +
view.sort = seeding
   
 
=== 手動でトラッカーを torrent に追加 ===
 
=== 手動でトラッカーを torrent に追加 ===
   
  +
# rTorrent のコンソールビューから編集する torrent を選択。
# Select torrent to edit from rTorrent console view.
 
# Hit {{ic|Ctrl+x}}.
+
# {{ic|Ctrl+x}} を押す。
  +
# もし4つのトラッカーがあったら、次の行を1つずつ入力してください (常に最初に {{ic|Ctrl+x}} を押してください) 例えば4つ追加することができます。
# If you had four trackers type following lines one at a time (always press {{ic|Ctrl+x}} first) to add four more for example:
 
   
 
d.tracker.insert="5","udp://tracker.publicbt.com:80"
 
d.tracker.insert="5","udp://tracker.publicbt.com:80"
413行目: 587行目:
 
d.tracker.insert="7","udp://tracker.istole.it:80"
 
d.tracker.insert="7","udp://tracker.istole.it:80"
 
d.tracker.insert="8","udp://tracker.ccc.de:80"
 
d.tracker.insert="8","udp://tracker.ccc.de:80"
  +
  +
=== torrent を特定の時刻に開始するように設定する ===
  +
  +
トレントをすぐにダウンロードせず、後で開始したい場合 (たとえば、データ プランに合わせるため)、トレントを特定のディレクトリに追加し、rtorrent にそのディレクトリを定期的にチェックするよう指示し、トレント ファイルが存在すれば、rtorrent は指定時刻にダウンロードを開始するようにすることができます。
  +
  +
# Start torrents at 1am in this directory
  +
schedule2 = watch_start,01:00:00,24:00:00, "load.start=/home/user/torrents/offpeak/*.torrent"
  +
  +
rtorrent は 24 時間ごとに {{ic|torrents/offpeak/}} ディレクトリをチェックし、トレント ファイルが存在する場合は午前 01:00 にそれを開始します。
   
 
== トラブルシューティング ==
 
== トラブルシューティング ==
430行目: 613行目:
 
$ 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 問題が修正] されます。
   
 
詳細は次を参照: [https://bbs.archlinux.org/viewtopic.php?pid=331850 rTorrent Error & CA Certificate] と [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]
441行目: 624行目:
 
クラッシュや不正のシャットダウンの後、ときどき rTorrent が動かなくなって、ロックファイルについてエラーを表示することがあります。
 
クラッシュや不正のシャットダウンの後、ときどき rTorrent が動かなくなって、ロックファイルについてエラーを表示することがあります。
   
  +
エラーメッセージによると、ダウンロード ディレクトリの隠しフォルダ {{ic|.rtorrentsession}} 内に '''rtorrent.lock''' というファイルが見つかった場合、手動で削除することができます。
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.
 
   
 
=== Event failed: bad return code ===
 
=== Event failed: bad return code ===
   
system.method.* の行に空白入っているのが原因で。空白削除れば動作するうになります。
+
これは、system.method.* の行にスペースある場合や、単にインストールされていない外部スクリプトを呼び出イベントハンドラ、または0以外の終了コード場合にく起こります。
  +
  +
前者については、偽のスペースを削除するか、意図的にパスなどを引用することで、動作するようになります。
   
 
== ウェブインターフェイス ==
 
== ウェブインターフェイス ==
   
 
rTorrent には様々なウェブインターフェイスやフロントエンドが存在しています:
 
rTorrent には様々なウェブインターフェイスやフロントエンドが存在しています:
  +
* [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])
* [[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] rtorrent (cli torrent クライアント) の Java で書かれたグラフィカルユーザーインターフェイスです。
+
* [https://github.com/jesec/flood Flood] - XMLRPC を使用して Node.js で書かれたモダンなインターフェイスです。
* [http://projects.cyla.homeip.net/rtwi/ rTWi] は PHP で書かれたシンプルな rTorrent ウェブインターフェイスです。
 
* [[Rtgui]] は PHP で書かれたウェブベースの rTorrent フロントエンドで、XML-RPC を使って rTorrent クライアントと対話します。
 
* [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 は現在、[http://xmlrpc-c.sourceforge.net/ XML-RPC for C/C++] を使用して構築されています。これは、一部の Web インターフェース (ruTorrent など) で必要とされています。).}}
   
 
=== XMLRPC インターフェイス ===
 
=== XMLRPC インターフェイス ===
   
  +
==== Unix ソケット ====
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
 
   
  +
rTorrent を Web インターフェイスで使用する場合、次の行を設定ファイルに追加し、'''user'' を rTorrent を実行するユーザーに置き換えてを実行する必要があります。
For more information see: [https://github.com/rakshasa/rtorrent/wiki/RPC-Setup-XMLRPC Using XMLRPC with rtorrent]
 
  +
network.scgi.open_local = /home/user/rpc.socket
  +
execute.nothrow = chmod,770,/home/user/rpc.socket
   
  +
詳しくはこちらをご覧ください。[https://github.com/rakshasa/rtorrent/wiki/RPC-Setup-XMLRPC Using XMLRPC with rtorrent] を参照してください。
=== マグネットリンクを watch フォルダに torrent ファイルとして保存 ===
 
   
  +
==== SCGI Port ====
{{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.}}
 
   
  +
{{Out of date|以下の scgi_port を使用すると、TCP を使用するため、''あらゆる''ローカル'' ユーザが rTorrent プロセスの所有ユーザとして''任意のコマンドを実行''することができます。ソケット ファイルに UNIX パーミッションを設定することで、上記の UNIX ドメイン ソケットを使用して、安全な暗号化通信を実現します。}}
If you wish to have magnet links automatically added to your watch folder, here is a script that will do the trick:
 
  +
  +
network.scgi.open_port = localhost:5000
  +
  +
=== magnet リンクを watch フォルダに torrent ファイルとして保存 ===
  +
  +
{{Note|Rtorrent はネイティブで magnet リンクによる torrent のダウンロードに対応しています。(Rtorrent を起動して 1 を押すと表示される) メインビューで、エンターを押してください。"load.normal>" に magnet リンクを貼り付けてエンターを再度押すとダウンロードが開始されます。}}
  +
  +
magnet リンクを watch フォルダに自動的に追加したい場合、以下のスクリプトで行うことができます:
   
 
#!/bin/bash
 
#!/bin/bash
477行目: 668行目:
 
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/)
   
  +
例えば、rtorrent-magnet という名前で保存し、実行権限を与え、$PATH の下のどこかに配置します。次に、Firefox で
Save it, for instance as rtorrent-magnet, give it execution permission, and place it somewhere under your $PATH. Then in Firefox:
 
# Type {{ic|about:config}} into the Location Bar (address bar) and press {{ic|Enter}}.
+
# ロケーション バー (アドレス バー) に {{ic|about:config}} と入力し、{{ic|Enter}} キーを押します。
# Right-click: ''New > Boolean > Name: '''network.protocol-handler.expose.magnet''' > Value > false''.
+
# 右クリックする。''新規 > Boolean > Name: '''network.protocol-handler.expose.magnet''' と入力します。> > false'' です。
  +
# 次回 magnet リンクをクリックすると、どのアプリケーションでそれを開くか尋ねられます。先ほど作成したスクリプトを選択すれば完了です。
# 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 {{ic|~/.local/share/applications/rtorrent-magnet.desktop}} with the following content:
+
xdg-open で処理したい場合、Firefox の代わりに chrome を使用している場合は必要ですが、(gnome やその他の DE では xdg-open を上書きする独自のプログラムがあるかもしれません)rtorrent-magnet スクリプト用のデスクトップ エントリを {{ic|~/.local/share/applications/rtorrent-magnet.desktop}} に次の内容で作成する必要があります。
   
  +
<nowiki>
 
[Desktop Entry]
 
[Desktop Entry]
 
Type=Application
 
Type=Application
491行目: 683行目:
 
Exec=rtorrent-magnet %U
 
Exec=rtorrent-magnet %U
 
MimeType=x-scheme-handler/magnet;
 
MimeType=x-scheme-handler/magnet;
NoDisplay=true
+
NoDisplay=true</nowiki>
   
  +
以下でmimetypeを登録するだけです。
Then all you need to do is to register the mimetype using:
 
 
$ xdg-mime default rtorrent-magnet.desktop x-scheme-handler/magnet
 
$ xdg-mime default rtorrent-magnet.desktop x-scheme-handler/magnet
   
  +
== magnet を Torrent に変換 ==
== rtorrent-pyro ==
 
  +
{{AUR|magnet2torrent-git}} パッケージを使うことでメタデータをダウンロードして torrent ファイルを作成することができます。
   
  +
使用方法:
[[AUR]] の {{AUR|rtorrent-pyro}} には rtorrent のコンソールインターフェイスが付属しています。pyroscope ツールは含まれていません。pyroscope ツールも必要な場合は [[#PyroScope]] を見て下さい。
 
  +
$ magnet2torrent <magnet link> [torrent file]
   
  +
== rtorrent-ps ==
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:
 
{{bc|<nowiki>schedule = bind_collapse,0,0,"ui.bind_key=download_list,*,view.collapsed.toggle="</nowiki>}}
 
   
  +
[https://github.com/pyroscope/rtorrent-ps rTorrent-PS] は、UI の強化、カラー化、およびいくつかの機能追加を行ったパッチセット形式の rTorrent ディストリビューションです。
Also set "pyro.extended" to 1 to activate rTorrent-PS features.
 
{{bc|<nowiki>system.method.insert = pyro.extended, value|const, 1</nowiki>}}
 
   
=== PyroScope ===
+
=== インストール方法 ===
   
  +
AUR から入手できる様々なパッケージを使うか、GitHub リポジトリにあるビルドスクリプトを使ってパッケージを作成してください。詳しくは [https://rtorrent-ps.readthedocs.io/en/latest/install.html#installation-on-arch-linux the docs] を見て下さい。
We create a directory for the installation of pyroscope, then download and update the source code from subversion:
 
{{bc|<nowiki>mkdir -p ~/.lib
 
svn checkout http://pyroscope.googlecode.com/svn/trunk/ ~/.lib/pyroscope
 
~/.lib/pyroscope/update-to-head.sh</nowiki>}}
 
Adding pyroscope bin's PATH to .bashrc:
 
{{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:
 
{{bc|<nowiki>pyroadmin --create-config</nowiki>}}
 
   
  +
=== 設定 ===
Add this to your ~/.rtorrent.rc. Don't forget to add the path of your pyroscope bin's dir (see below).
 
{{bc|<nowiki>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=</nowiki>}}
 
   
  +
rTorrent 設定ファイルで ''pyro.extended'' を 1 に設定し、rTorrent-PS 機能を有効にします。
Optionally: TORQUE: Daemon watchdog schedule. Must be activated by touching the "~/.pyroscope/run/pyrotorque" file!
 
  +
{{bc|<nowiki>method.insert = pyro.extended, value|const, 1</nowiki>}}
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]
 
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>}}
 
   
  +
その他の設定例については、[https://github.com/pyroscope/pimp-my-box/tree/master/roles/rtorrent-ps/templates/rtorrent/rtorrent.d pimp-my-box] リポジトリの rtorrent-ps テンプレートを参照してください。動作させるには PyroScope のコマンドライン ユーティリティが必要な場合があることに注意してください。
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:
 
{{bc|<nowiki>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</nowiki>}}
 
   
  +
== PyroScope コマンドラインユーティリティ ==
And now set the missing "completed" times to that of the data file or directory:
 
{{bc|<nowiki>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</nowiki>}}
 
   
  +
[https://github.com/pyroscope/pyrocore/ PyroScope コマンドラインユーティリティ] は、rTorrent クライアント用のツールのコレクションで、[[#rtorrent-ps]]パッチセットと一緒に使用すると便利です。
Example usage:
 
  +
特に、一般的なタスクの自動化や、rTorrent のキュー マネージャを提供します。
Will print out all torrents older than 2 hours:
 
  +
{{bc|<nowiki>rtcontrol -V completed=+2h -scompleted -ocompleted</nowiki>}}
 
  +
インストールと設定については、[https://pyrocore.readthedocs.io/ 公式ドキュメント] に従ってください。その他の設定例については、[https://github.com/pyroscope/pimp-my-box/tree/master/roles/rtorrent-ps/templates/rtorrent/rtorrent.d pimp-my-box] リポジトリの rtorrent-ps テンプレートを参照してください。
Deletes all torrents older than 48 hours:
 
{{bc|<nowiki>rtcontrol -V completed=+48h -scompleted -ocompleted --cull --yes</nowiki>}}
 
   
 
== 参照 ==
 
== 参照 ==
   
 
* [http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html Manpage for rtorrent]
 
* [http://libtorrent.rakshasa.no/rtorrent/rtorrent.1.html Manpage for rtorrent]
  +
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] Wikipedia
* [[Screen ヒント]]
 
  +
* [http://community.rutorrent.org/ rTorrent Community Wiki] - セットアップ、構成、運用、および開発に関するrTorrentおよびrTorrentに関連するプロジェクトに関する情報の公開場所。
* [[Wikipedia:Comparison of BitTorrent clients|Comparison of BitTorrent clients]] on Wikipedia
 
  +
* [https://code.google.com/p/pyroscope/ PyroScope] - rTorrent 用のコマンドラインツールのコレクション。トレント ファイルの作成と変更、複数のウォッチ フォルダーを使用しない完了時のデータの移動、rTorrent の XML-RPC インターフェイスを介したダウンロード アイテムの一括制御 (検索、開始/停止、データ付き/データなしのアイテムの削除など) のためのコマンドを提供します。また、文書化された [[Python]] も提供されています。APIを提供します。
* [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.
 
 
* [[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] - BitTorrent プロトコル、特に rTorrent クライアントのためのツール集
 
* [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] - (標準リポジトリにあります) プロセスはターミナルや tmux、screen、dtach のソケットにアタッチされるようになったかもしれません。プログラムの TTY を引き継ぐための別のツールです
 
  +
* [http://caca.zoy.org/wiki/neercs neercs] - reptyr よりも screen/tmux に似たツールですが、reptyr と同様に、neercs は、端末または tmux、screen、または dtach のソケットにスレーブとして開始された可能性のあるプロセスを "steal" することもできます。
 
'''フォーラムスレッド'''
 
'''フォーラムスレッド'''
 
* 2009-03-11 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=67304 HOWTO: rTorrent stats in Conky]
 
* 2009-03-11 - Arch Linux - [https://bbs.archlinux.org/viewtopic.php?id=67304 HOWTO: rTorrent stats in Conky]

2023年11月25日 (土) 04:06時点における最新版

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

インストール

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

非公式パッケージ

設定

ノート: 設定に関する詳細は次の 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)。

ノート: Ctrl-q を 2 回連続で押すと、接続中のトラッカーへの停止アナウンスの送信を待たずに rTorrent がシャットダウンします。
コマンド 操作
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 ファイルに追加することで、起動時に自動的にマッピングを削除させることができます。

ヒントとテクニック‎

ヘッドレスサーバのための Systemd サービス

このユニット ファイルは、rtorrent という 1 人のユーザーの実行と、rtorrent がデーモンとして実行されるように設定することに依存しています。

次のファイルを作成します。

/etc/systemd/system/rtorrent.service
>
[Unit]
Description=rTorrent System Daemon
After=network.target

[Service]
Type=simple
User=rtorrent
Group=rtorrent
# Modify the next 2 lines to use absolute paths
ExecStartPre=-/bin/rm -f /<home>/.session/rtorrent.lock
ExecStart=/usr/bin/rtorrent -o import=/<home>/rtorrent.rc
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target

ユーザーのためのデーモンとしての Systemd サービス

このユニットでは、複数のユーザー、または 1 人のユーザーが rtorrent をデーモンとして実行できるようにします。

ブート時に rtorrent を起動するには、有効 rtorrent@user (user は rtorrent を実行するユーザー) を指定します。

以下のファイルを作成します。

/etc/systemd/system/rtorrent@.service
[Unit]
Description=rTorrent for %i
After=network.target

[Service]
Type=simple
User=%i
Group=%i
WorkingDirectory=/home/%i
# Modify the next line to the absolute path for rtorrent.lock, for example
ExecStartPre=-/bin/rm -f /home/%i/.session/rtorrent.lock
ExecStart=/usr/bin/rtorrent -o system.daemon.set=true
Restart=on-failure
RestartSec=3

[Install]
WantedBy=multi-user.target

tmux や screen を使った Systemd サービス

以下のサービスは、サービスユニットの種類によって使用方法が異なります。

システムサービスの場合(/etc/systemd/system/ の中)

ブート時に起動させる:

# systemctl enable rtorrent

手動で起動:

# systemctl start rtorrent

ストップ:

# systemctl stop rtorrent 

rtorrent ユーザーが適切なホーム ディレクトリに作成され、rtorrent.rc が配置されていることを確認します。

ユーザーサービス (/etc/systemd/user/ の中):

$ systemctl --user enable rtorrent

手動で起動:

$ systemctl --user start rtorrent

ストップ:

$ systemctl --user stop rtorrent

screen を使用

  • システム・サービス・ユニットとして
/etc/systemd/system/rtorrent.service
[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
User=rtorrent
ExecStartPre=/usr/bin/bash -c "if test -e %h/.rtorrent_session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f %h/.rtorrent_session/rtorrent.lock; fi"
ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/bash -c "test `pidof rtorrent` && killall -w -s 2 /usr/bin/rtorrent"
WorkingDirectory=%h
Restart=on-failure

[Install]
WantedBy=multi-user.target
  • ユーザーサービスユニットとして
/etc/systemd/user/rtorrent.service
[Unit]
Description=rTorrent
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -dmfa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -sユーザーのためのデーモンとしての Systemd サービス 2 /usr/bin/rtorrent
WorkingDirectory=%h

[Install]
WantedBy=default.target

rtorrent のセッションにアタッチします。

screen -D -r rtorrent

tmux を使用

  • 独立した tmux サーバー付き (クラッシュした場合は rtorrent を再起動)
~/.config/systemd/user/rtorrent.service
[Unit]
Description=rtorrent
After=network.target

[Service]
Type=forking
ExecStartPre=/usr/bin/bash -c "if test -e ~/.session/rtorrent.lock && test -z `pidof rtorrent`; then rm -f ~/.session/rtorrent.lock; fi"
ExecStart=/usr/bin/tmux -L rt new-session -s rt -n rtorrent -d rtorrent 
ExecStop=/usr/bin/bash -c "/usr/bin/tmux -L rt send-keys -t rt:rtorrent.0 C-q; while pidof rtorrent > /dev/null; do echo stopping rtorrent...; sleep 1; done"
Restart=on-failure

[Install]
WantedBy=default.target
  • tmux をユーザー rtorrent として実行した場合 (クラッシュした場合は 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/bash -c "/usr/bin/tmux send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done"
WorkingDirectory=%h
Restart=on-failure

[Install]
WantedBy=multi-user.target

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

tmux -L rt attach -t rt
tmux attach -t rt

デタッチ:

Ctrl-b d

dtach を使った systemd サービスファイル

systemd 単位で dtach を実行する場合、rtorrent が動作するためには 環境変数 が明示的に設定されている必要があります。

このサービス ファイルには再起動がありません。これは、作者が問題のドライブをオフラインにすることがあり、このシナリオで起動すると rtorrent が失敗し、各トレントを格納する特定のディレクトリなど、多くのトレント固有の設定が失われるためです (最適化されていない と言うべきでしょうか) 実際、rtorrent を起動するシンボリック リンクは、関連ドライブに存在します。 rtorrent の起動をブロックするこの使用例は、NAS、USB、eSATA ドライブなどのリムーバブル メディアにダウンロードしたファイルを置くユーザーに関連するものです。

~/.config/systemd/user/rtorrent.service
[Unit]
Description=rTorrent
#After=network.target

[Service]
# set TERM according to your terminal
Environment="TERM=xterm"
#Environment="TERM=linux" 
Type=forking
KillMode=none
ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /home/sam/bin/rtr_new -n -o import=/home/sam/.config/rtorrent/new_.rc 
   # dtach -n <separate filename for each instance>
   # 
   # rtr_new -n to ignore the default .rtorrent.rc
   # rtr_new -o import to load the instance-specific rc
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new

[Install]
WantedBy=multi-user.target

このサービスファイルには、dtach 以外にもいくつかの問題があることに注意してください。

/home/sam/bin/rtr_new is a symlink to /usr/bin/rtorrent

これにより、複数のインスタンスを実行し、それぞれを異なるバージョンの ExecStop で個別に終了させることができます。

ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_new
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_academic
ExecStop=-/usr/bin/killall -u sam -e -w -s INT /home/sam/bin/rtr_other_stuff

これらはそれぞれ別のサービスファイル内にあり、それぞれが1つのインスタンスを制御します。

このステップを実行しないと、複数のインスタンスを実行している場合、killall ソリューションにより実行中のすべての rtorrent インスタンスが削除されます。

複数の rtorrent インスタンスが不要で、rtorrent rc ファイルがデフォルトの場所にある場合、上記のサービス ファイルを簡略化することができます。 ファイル全体が含まれますが、ExecStart と ExecStop の行が変わります。

~/.config/systemd/user/rtorrent.service
[Unit]
Description=rTorrent
#After=network.target

[Service]
# set TERM according to your terminal
Environment="TERM=xterm"
#Environment="TERM=linux" 
# Type=forking is not required if ExecStart command is run using dtach -N (i.e dtach will run on foreground).
Type=forking
KillMode=none
ExecStart=-/usr/bin/dtach -n /home/sam/run/dtach_fifos/fifo -e "^T" /usr/bin/rtorrent 
   # dtach -n <user specified FIFO name> -e <user specified character> /usr/bin/rtorrent 
ExecStop=/usr/bin/killall -w -s INT /usr/bin/rtorrent
   # -e (exact match) and -u (user name) were added above to stop specific processes
   #  and may be omitted here because only one rtorrent will be running

[Install]
WantedBy=multi-user.target

ExecStart=-/usr/bin/dtach` の部分にあるハイフンに注意してください。これは、失敗の終了コードも成功の終了を表すことができるようにするためです。これは現在の問題 [1] のためと思われます。代替案としては、サービスセクションで `SuccessExitStatus=1` を使用することです。

このサービスは systemctl --user で制御することができます。起動したら、セッションにアタッチすることができます。

$ dtach -a /home/sam/run/dtach_fifos/fifo -e "^T".

事前割り当て

rTorrent には、トレント用の領域を事前に割り当てる機能があります。主な利点は、ファイル システムの断片化を制限および回避できることです。ただし、ファイルシステムが fallocate システムコールをネイティブでサポートしていない場合、事前割り当て時に遅延が発生します。

したがって、このスイッチは、fallocate システムコールをネイティブでサポートしている xfs、ext4、btrfs、および ocfs2 ファイルシステムに推奨されます。これらのファイルシステムでは、事前割り当て時の遅延がなく、ファイルシステムが断片化することもありません。他のファイルシステムでの事前割り当ては、遅延は発生しますが、ファイルの断片化は起こりません。

これを有効にするには:

~/rtorrent.rc
  # Preallocate files; reduces defragmentation on filesystems.
  system.file.allocate = 1

上記以外のファイルシステムでプリアロケーションを利用できるようにするには、(遅れはあるものの)次の新しいスイッチを使用して、ABS ツリーから libTorrent を再コンパイルすることで可能です。

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

参照 the upstream documentation for further information

完了したファイルの管理

ウォッチフォルダあり

ノート: このヒントで困っている場合、こちらも参照して見て下さい。docs

rtorrent は、シードを継続しながら、*.torrent をどの ウォッチ フォルダにドロップしたかに基づいて、完了したトレント データを特定のフォルダに整理することができます。

解決策として、~/.rtorrent.rc で次の例を使用してください。必ずパスを変更してください。

# default path for in progress downloads
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.normal'
schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete"

# upon completion, move content to path specified above via custom1
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="

このように、ウォッチディレクトリとそれに対応する補完ディレクトリを追加することができます:

directory = /home/user/torrents/incomplete

schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.custom1.set=/home/user/torrents/complete"
schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.custom1.set=/home/user/torrents/complete/iso"
schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.custom1.set=/home/user/torrents/complete/music"

method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="

また、ウォッチディレクトリごとに不完全なディレクトリを指定することも可能です:

directory = /home/user/torrents/incomplete

schedule2 = watch_directory_1,10,10,"load.start=/home/user/torrents/watch/*.torrent,d.directory.set=/home/user/torrents/incomplete,d.custom1.set=/home/user/torrents/complete"
schedule2 = watch_directory_2,10,10,"load.start=/home/user/torrents/watch/iso/*.torrent,d.directory.set=/home/user/torrents/incomplete/iso,d.custom1.set=/home/user/torrents/complete/iso"
schedule2 = watch_directory_3,10,10,"load.start=/home/user/torrents/watch/music/*.torrent,d.directory.set=/home/user/torrents/incomplete/music,d.custom1.set=/home/user/torrents/complete/music"

method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1="

また、bash スクリプトによる補完移動pyrocore の rtcontrol (AUR パッケージがあります) も参照してください。

ウォッチフォルダ無し

rtorrent が完成したフォルダーの場所をラベルごとに自動的に管理することを希望する場合は、以下を rtorrent.rc 構成に追加し、環境に合わせてパスを修正します:

# Check if destination dir is not Null
method.set_key = event.download.inserted_new,check_dest_dir, \
"branch=d.custom=storagedir,,\
 \"d.custom.set=storagedir,/path/to/download/directory\""

# Modify destination dir according to tv label
method.set_key = event.download.inserted_new,update_dest_dir_tv, \
"branch=\"equal={d.custom1=, cat=TV}\",\
 \"d.custom.set=storagedir,/path/to/tv/dir\""

# Modify destination dir according to movies label
method.set_key = event.download.inserted_new,update_dest_dir_movies, \
"branch=\"equal={d.custom1=, cat=Movies}\",\
  \"d.custom.set=storagedir,/path/to/movie/dir\""

# Move files of completed torrents
method.set_key = event.download.finished,move_completed, \
"d.directory.set=$d.custom=storagedir; \
     execute2={mv,-u,$d.base_path=,$d.custom=storagedir}"
ノート: さらにラベルを追加するには、2 番目または 3 番目の段落をコピーして、'TV' または 'Movies' の各インスタンスを新しいラベルに置き換えます。

このユースケースの例は、ZFS を使用していて、ソース素材を同じファイルシステム上に置く必要がある場合です。rTorrent は一時的な NVMe/SSD にダウンロードし、コンテンツを ZFS ファイルシステムに移動します。そこで *arrs がメディアを処理し、メディアサーバーがスクレイピングする別のフォルダーにハードリンクします。

Google メールでの通知

携帯電話に メール を送ることもできます。

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

ここで、$@ はスクリプトに渡されるすべての引数を保持する変数です。

最後に、重要な ~/.rtorrent.rc 行を追加します。

以下分解です:

notify_me はコマンドIDで、他のコマンドで使用される可能性があり、ユニークであれば何でもかまいません。

execute= は、rtorrent コマンドで、この場合はシェル コマンドを実行します。

/path/to/mail.sh は、スクリプトの名前 (または実行するコマンド) と、渡されるすべてのスイッチ/引数をカンマで区切ったリストです。

$d.get_name= d はコマンドのトリガーとなるダウンロードのエイリアス、get_name はダウンロードの名前を返す関数、$ は実行を呼び出す前にコマンドをその出力に置き換えるよう rTorrent に指示します。

最終結果は? 出勤前に開始したトレント、All Live Nudibranches が終了すると、テキストが送信されます。

All Live Nudibranches: Done

UI トリック

rTorrent はデフォルトでアクティブなタブを正しく表示しません。アクティブなトレントのみを表示するには、次の行を .rtorrent.rc に追加してください。

schedule2 = filter_active,30,30,"view.filter = active,\"or={d.up.rate=,d.down.rate=}\""

次に、rTorrent クライアントで 9 を押して、変更点を確認します。

シードビューをアップロード率でソートし、ピアのいるトレントのみを表示するには。

# Sort the seeding view by the upload rate and only show torrents with peers
view.sort_current = seeding,greater=d.up.rate=
view.filter = seeding,"and=d.complete=,d.peers_connected="
view.sort_new = seeding,less=d.up.rate=
view.sort = seeding

完全なビューをアップロード率でソートする場合。

# Sort the complete view by the upload rate
view.sort_current = complete,greater=d.up.rate=
view.filter = seeding,"and=d.complete="
view.sort_new = seeding,less=d.up.rate=
view.sort = seeding

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

  1. rTorrent のコンソールビューから編集する torrent を選択。
  2. Ctrl+x を押す。
  3. もし4つのトラッカーがあったら、次の行を1つずつ入力してください (常に最初に Ctrl+x を押してください) 例えば4つ追加することができます。
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"

torrent を特定の時刻に開始するように設定する

トレントをすぐにダウンロードせず、後で開始したい場合 (たとえば、データ プランに合わせるため)、トレントを特定のディレクトリに追加し、rtorrent にそのディレクトリを定期的にチェックするよう指示し、トレント ファイルが存在すれば、rtorrent は指定時刻にダウンロードを開始するようにすることができます。

# Start torrents at 1am in this directory
schedule2 = watch_start,01:00:00,24:00:00, "load.start=/home/user/torrents/offpeak/*.torrent"

rtorrent は 24 時間ごとに torrents/offpeak/ ディレクトリをチェックし、トレント ファイルが存在する場合は午前 01:00 にそれを開始します。

トラブルシューティング

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 が動かなくなって、ロックファイルについてエラーを表示することがあります。

エラーメッセージによると、ダウンロード ディレクトリの隠しフォルダ .rtorrentsession 内に rtorrent.lock というファイルが見つかった場合、手動で削除することができます。

Event failed: bad return code

これは、system.method.* の行にスペースがある場合や、単にインストールされていない外部スクリプトを呼び出すイベントハンドラ、または0以外の終了コードを返す場合によく起こります。

前者については、偽のスペースを削除するか、意図的にパスなどを引用することで、動作するようになります。

ウェブインターフェイス

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

  • rutorrentForum - uTorrent とよく似たインターフェイスを持つウェブベースのフロントエンドです。多数のプラグインと高度な機能をサポートしています (参照:ruTorrentGuide on forum)
  • Flood - XMLRPC を使用して Node.js で書かれたモダンなインターフェイスです。
ノート: rTorrent は現在、XML-RPC for C/C++ を使用して構築されています。これは、一部の Web インターフェース (ruTorrent など) で必要とされています。).

XMLRPC インターフェイス

Unix ソケット

rTorrent を Web インターフェイスで使用する場合、次の行を設定ファイルに追加し、'user を rTorrent を実行するユーザーに置き換えてを実行する必要があります。

network.scgi.open_local = /home/user/rpc.socket
execute.nothrow = chmod,770,/home/user/rpc.socket

詳しくはこちらをご覧ください。Using XMLRPC with rtorrent を参照してください。

SCGI Port

この記事またはセクションは情報が古くなっています。
理由: 以下の scgi_port を使用すると、TCP を使用するため、あらゆるローカル ユーザが rTorrent プロセスの所有ユーザとして任意のコマンドを実行することができます。ソケット ファイルに UNIX パーミッションを設定することで、上記の UNIX ドメイン ソケットを使用して、安全な暗号化通信を実現します。 (Discuss)
network.scgi.open_port = localhost:5000

magnet リンクを watch フォルダに torrent ファイルとして保存

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

magnet リンクを 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/)

例えば、rtorrent-magnet という名前で保存し、実行権限を与え、$PATH の下のどこかに配置します。次に、Firefox で

  1. ロケーション バー (アドレス バー) に about:config と入力し、Enter キーを押します。
  2. 右クリックする。新規 > Boolean > Name: network.protocol-handler.expose.magnet と入力します。> 値> false です。
  3. 次回 magnet リンクをクリックすると、どのアプリケーションでそれを開くか尋ねられます。先ほど作成したスクリプトを選択すれば完了です。

xdg-open で処理したい場合、Firefox の代わりに chrome を使用している場合は必要ですが、(gnome やその他の DE では xdg-open を上書きする独自のプログラムがあるかもしれません)rtorrent-magnet スクリプト用のデスクトップ エントリを ~/.local/share/applications/rtorrent-magnet.desktop に次の内容で作成する必要があります。

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

以下でmimetypeを登録するだけです。

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

magnet を Torrent に変換

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

使用方法:

$ magnet2torrent <magnet link> [torrent file]

rtorrent-ps

rTorrent-PS は、UI の強化、カラー化、およびいくつかの機能追加を行ったパッチセット形式の rTorrent ディストリビューションです。

インストール方法

AUR から入手できる様々なパッケージを使うか、GitHub リポジトリにあるビルドスクリプトを使ってパッケージを作成してください。詳しくは the docs を見て下さい。

設定

rTorrent 設定ファイルで pyro.extended を 1 に設定し、rTorrent-PS 機能を有効にします。

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

その他の設定例については、pimp-my-box リポジトリの rtorrent-ps テンプレートを参照してください。動作させるには PyroScope のコマンドライン ユーティリティが必要な場合があることに注意してください。

PyroScope コマンドラインユーティリティ

PyroScope コマンドラインユーティリティ は、rTorrent クライアント用のツールのコレクションで、#rtorrent-psパッチセットと一緒に使用すると便利です。 特に、一般的なタスクの自動化や、rTorrent のキュー マネージャを提供します。

インストールと設定については、公式ドキュメント に従ってください。その他の設定例については、pimp-my-box リポジトリの rtorrent-ps テンプレートを参照してください。

参照

  • Manpage for rtorrent
  • Comparison of BitTorrent clients Wikipedia
  • rTorrent Community Wiki - セットアップ、構成、運用、および開発に関するrTorrentおよびrTorrentに関連するプロジェクトに関する情報の公開場所。
  • PyroScope - rTorrent 用のコマンドラインツールのコレクション。トレント ファイルの作成と変更、複数のウォッチ フォルダーを使用しない完了時のデータの移動、rTorrent の XML-RPC インターフェイスを介したダウンロード アイテムの一括制御 (検索、開始/停止、データ付き/データなしのアイテムの削除など) のためのコマンドを提供します。また、文書化された Python も提供されています。APIを提供します。
  • ruTorrent と Lighttpd
  • How-to install rTorrent and Hellanzb on CentOS 5 64-bit VPS
  • Installation guide for rTorrent and Pryoscope on Debian - BitTorrent プロトコル、特に rTorrent クライアントのためのツール集
  • mktorrent - torrent ファイルを作成するためのコマンドラインアプリケーション、公式リポジトリmktorrent でインストールできます。
  • docktorrent - Docker, rTorrent, ruTorrent を使用してフル機能の BitTorrent マシンを実行。
  • reptyr - (標準リポジトリにあります) プロセスはターミナルや tmux、screen、dtach のソケットにアタッチされるようになったかもしれません。プログラムの TTY を引き継ぐための別のツールです
  • neercs - reptyr よりも screen/tmux に似たツールですが、reptyr と同様に、neercs は、端末または tmux、screen、または dtach のソケットにスレーブとして開始された可能性のあるプロセスを "steal" することもできます。

フォーラムスレッド