
创建文件 /etc/systemd/system/qbittorrent-nox.service,填入:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| [Unit] Description=qBittorrent-nox Daemon After=network.target remote-fs.target Wants=remote-fs.target
[Service] Type=simple User=<User> Group=<User> Environment=HOME=/home/<User> WorkingDirectory=/home/<User> ExecStart=</path/to/qbittorrent-nox> --webui-port=10180 --profile=</path/to/config> ExecStop=/bin/kill -s SIGINT $MAINPID Restart=on-failure RestartSec=5 KillSignal=SIGINT KillMode=process TimeoutStopSec=30
[Install] WantedBy=multi-user.target
|
所有 <> 包裹的部分需要手动修改。主要是用户名和 qbittorrent-nox 的位置。
需要注意 qbittorrent-nox 二进制文件有可执行权限,且配置目录有可读写权限。
重载配置:
1
| sudo systemctl daemon-reload
|
启用服务并运行:
1
| sudo systemctl enable --now qbittorrent-nox
|