我正在尝试安装 rTorrent 和 ruTorrent 的 Ubuntu 14.04 系统。我已经安装了 rTorrent,使用我自己的用户帐户就可以正常启动。
我创建了一个名为 rtorrent 的新用户帐户来运行 rTorrent。
sudo adduser --system --group rtorrent
.rtorrent.rc
接下来我设置了配置文件/home/rtorrent
并让 rtorrent 成为该文件的所有者。
sudo chown rtorrent:rtorrent .rtorrent.rc
我非常希望它能够rtorrent
自动启动。我从以下 init 脚本中借用了本指南:
#!/bin/bash
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop rtorrent daemon
### END INIT INFO
## Username to run rtorrent under, make sure you have a .rtorrent.rc in the
## home directory of this user!
USER="rtorrent"
## Absolute path to the rtorrent binary.
## run "which rtorrent"
RTORRENT="/usr/local/bin/rtorrent"
## Absolute path to the screen binary.
SCREEN="/usr/bin/screen"
## Name of the screen session, you can then "screen -r rtorrent" to get it back
## to the foreground and work with it on your shell.
SCREEN_NAME="rtorrent"
## Absolute path to rtorrent's PID file.
PIDFILE="/var/run/rtorrent.pid"
## Absolute path to rtorrent's XMLRPC socket.
SOCKET="/var/run/rtorrent/rpc.socket"
## Check if the socket exists and if it exists delete it.
delete_socket() {
if [[ -e $SOCKET ]]; then
rm -f $SOCKET
fi
}
case "$1" in
## Start rtorrent in the background.
start)
echo "Starting rtorrent."
delete_socket
start-stop-daemon --start --background --oknodo \
--pidfile "$PIDFILE" --make-pidfile \
--chuid $USER \
--exec $SCREEN -- -DmUS $SCREEN_NAME $RTORRENT
if [[ $? -ne 0 ]]; then
echo "Error: rtorrent failed to start."
exit 1
fi
echo "rtorrent started successfully."
;;
## Stop rtorrent.
stop)
echo "Stopping rtorrent."
start-stop-daemon --stop --oknodo --pidfile "$PIDFILE"
if [[ $? -ne 0 ]]; then
echo "Error: failed to stop rtorrent process."
exit 1
fi
delete_socket
echo "rtorrent stopped successfully."
;;
## Restart rtorrent.
restart)
"$0" stop
sleep 1
"$0" start || exit 1
;;
## Print usage information if the user gives an invalid option.
*)
echo "Usage: $0 [start|stop|restart]"
exit 1
;;
esac
下一个:
sudo chmod +x /etc/init.d/rtorrent
sudo update-rc.d rtorrent defaults 99
遗憾的是,重启后
sudo top
rtorrent
根本就看不见。当我
sudo /etc/init.d/rtorrent start
收到了已经开始的消息rtorrent
,但是运行还是找不到top
。
我怎样才能让它工作?
答案1
发完这个问题后不久,我突然明白了。我的.rtorrent.rc
文件对于两个用户来说并不相同。修复用户 rtorrent 的配置后,一切正常。