我刚刚在我的 arch-linux 系统(2012.09.07)上完成了 systemd 的安装和设置过程。我卸载了initscripts(并删除了配置文件)。
我想要做的是创建一个可以由非 root 用户启动和停止的服务。该服务将启动一个运行 rtorrent 的分离屏幕会话。但是,我希望系统上已将此服务设置为启动(启用)的每个用户都专门为他们启动一个特定的实例。怎么做呢?
我记得读过 systemd 支持服务的用户实例,但是我一直无法找到有关如何设置它的任何信息,或者它是否与我要查找的内容有关。
我用于系统的服务文件:
[Unit]
Description=rTorrent
[Service]
Type=forking
ExecStart=/usr/bin/screen -d -m -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
Run Code Online (Sandbox Code Playgroud)
更新#1:
阅读此处和此处的手册页后,我了解 systemd 如何更好地工作。具体来说,使用User=和WorkingDirectory=选项允许在用户会话中启动服务。然而问题仍然存在,用户自己不能start,stop,enable, 或disable服务。一个访问被拒绝错误由下式给出systemctl。
更新#2:
首先,为了简化和更好地使用 systemd 的用户会话(仍然有些不完整)功能,我使用了sofar 的 user-session-units并遵循了他的配置建议。
似乎在当前版本的 DBus (1.6.4-1) 中存在一个错误,其中它没有DBUS_SESSION_BUS_ADDRESS使用systemctl --user命令错误设置环境变量含义:
Failed to get D-Bus connection: …Run Code Online (Sandbox Code Playgroud) 我已经在一个目录中使用 rtorrent 一段时间了。现在我发现可以使用不同的目录,甚至可以将完成的下载移动到其他地方,所以根据 rtorrent wiki 我编辑了我的 .rtorrent.rc 如下:
# Download directory
directory = /Medias/torrents/
# Watching directories
schedule = watch_directory_1,5,60,"load_start=/path/to/dl/dir1/*.torrent,d.set_custom1=/path/to/done/dir1"
schedule = watch_directory_2,5,60,"load_start=/path/to/dl/dir2/*.torrent,d.set_custom1=/path/to/done/dir2"
# On completion, move the torrent to the directory from custom1.
system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
Run Code Online (Sandbox Code Playgroud)
它似乎适用于新的种子。但是,我之前已经下载了一堆已完成的文件来拆分目录,对它们来说这是行不通的:如果我删除会话目录中的文件,rtorrent 将检查散列但不会移动它们,如果我自己移动它们 rtorrent 不会看到它们,并会尝试重新下载它们。
那么我怎么能告诉 rtorrent 移动它们或者它们在另一个目录中呢?
谢谢。
我希望 rTorrent 在我从 UI 中删除种子数据时删除它。
我查看了.rtorrent.rc文档,找到了on_erase设置,但现在已经贬值了。它的替代品system.method.set_key = event.download.erased没有很好的记录。
我应该添加什么.rotorrent.rc以使其在删除种子时删除文件?
我的列表中有某些种子,我想在播种时优先考虑这些种子。是否有具有此选项的 Torrent 客户端?
我想提一下,像暂停其他 torrent 或限制其他 torrent 的上传限制这样的黑客攻击不是可持续的长期解决方案。可持续的黑客攻击当然是受欢迎的。
如何让 rtorrent 在完成下载 torrent 后运行脚本,并将 torrent 文件夹的完整路径作为参数?
我不是 root,所以我必须从源代码构建 rtorrent 并希望将它安装在我的主目录中,但它失败了,为什么?
[mirror@hugemeow rtorrent]$ ls
AUTHORS  autogen.sh  ChangeLog  configure.ac  COPYING  doc  INSTALL  Makefile.am  NEWS  rak  README  scripts  src  test
[mirror@hugemeow rtorrent]$ ./autogen.sh
aclocal...
aclocal:configure.ac:7: warning: macro `AM_PATH_CPPUNIT' not found in library
autoheader...
libtoolize... using libtoolize
automake...
configure.ac: installing `./install-sh'
configure.ac: installing `./missing'
src/Makefile.am: installing `./depcomp'
autoconf...
configure.ac:7: error: possibly undefined macro: AM_PATH_CPPUNIT
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Run Code Online (Sandbox Code Playgroud)
尽管 autoge 失败,但配置脚本已创建。
[mirror@hugemeow rtorrent]$ ls
aclocal.m4  autogen.sh      ChangeLog     config.h.in  configure …Run Code Online (Sandbox Code Playgroud) 我正在使用 rTorrent 0.9.2/0.13.2。我还没有在 1-0 按钮上找到这样的标签,而且在 Google 中搜索也没有提供任何有用的链接。我必须在配置中自行设置吗?
更新: 更清楚地说:
 Yes Studio Discography 1969-1972
            1308.0 / 10191.2 MB Rate:   0.0 /   0.0 KB Uploaded:  1027.5 MB [12%] --d --:-- [T  R: 0.79]
Run Code Online (Sandbox Code Playgroud)
有 0.0 / 0.0 KB,此 torrent 目前未下载或上传。我需要列出当前上传/下载速度有一定数量的种子,而不是 0.0/0.0 KB。这就是我所说的下载/上传种子的意思。
当我打开 torrent 的文件列表时,文件名随机出现:
*** some.series.name - 1 season ***
               Cmp Pri  Size   Filename
Peer list        0     744.3 M| some.series.name.S01E20 (rus,eng).mkv                                                                                                                                               
                 0     742.2 M| some.series.name.S01E07 (rus,ukr,eng).mkv
Info            43     734.3 M| some.series.name.S01E19 (rus,eng).mkv
                 1     725.0 M| some.series.name.S01E10 (rus,eng).mkv
File list       16     721.4 M| some.series.name.S01E08 (rus,ukr,eng).mkv
                17     720.1 M| some.series.name.S01E18 (rus,eng).mkv
Tracker list   100 hig 700.8 M| some.series.name.S01E02 (rus,ukr,eng).mkv
                87     696.8 M| some.series.name.S01E12 (rus,eng).mkv
Chunks seen    100 hig 695.5 M| some.series.name.S01E01 (rus,ukr,eng).mkv
                 9     693.8 M| some.series.name.S01E11 (rus,eng).mkv
Transfer list    0     691.9 M| some.series.name.S01E15 …Run Code Online (Sandbox Code Playgroud) 我正在使用 rtorrent 下载安装在树莓派上的 SD 卡上的文件,速度约为 6MB/s(带宽上限)。用户进程本身不会刷新数据,刷新磁盘缓存的时间间隔取决于 sysctl 值。
使用 iostat 和 nload 我可以看到网络带宽和磁盘写入配置文件:
磁盘:
20M/s .....x.....x....xx...
      .....x....xx....xx...
      ....xx....xx....xx...
0M/s  ....xx....xx....xx...
Run Code Online (Sandbox Code Playgroud)
网络:
5M/s  ..xxx....x.. x.....x.
      .xxxx...xx..xxx...xxx
0M/s  xxxxx...xxx.xxx...xxx
Run Code Online (Sandbox Code Playgroud)
显然,IO 写入器在刷新期间总是暂停。这是一个 4 核 CPU,其中 3 核永久空闲,并且在刷新期间 top 表示 100% iowait。
如果我while true; do sync; sleep 1; done在下载时这样做,磁盘刷新会以每秒 6MB 的速度平滑。并且下载器进程不会被阻塞,因此带宽是恒定的。
我可以通过以下方式获得相同的效果:
/proc/sys/vm/dirty_writeback_centisecs:
磁盘缓存刷新的频率 - 单位为 100 秒;默认值:500
以及/proc/sys/vm/dirty_expire_centisecs:
一个页面必须多大才能在 100 秒内刷新;默认值:3000
将它们分别设置为 100 和 200 可实现相同的均匀磁盘刷新配置文件和恒定的下载带宽。
有没有办法使这种调整自动进行,即尽可能频繁地刷新以避免阻塞写入进程?例如,如果下载速度为 1MB/s,那么每 5 秒刷新一次可能就足够了。
如何在 Linux (Ubuntu) 上使用 rtorrent 通过命令行下载磁力链接?
我知道我可以
rtorrent但是我想要一个或几个命令行,而不是键盘快捷键。
rtorrent ×10
bittorrent ×2
linux ×2
arch-linux ×1
autoconf ×1
autotools ×1
build ×1
cache ×1
centos ×1
command-line ×1
ktorrent ×1
magnet-links ×1
networking ×1
systemd ×1
unix ×1
user ×1
utorrent ×1