Is there rTorrent/libTorrent packets for oleg firmware?
http://libtorrent.rakshasa.no/
And if not, is there any chance to build them?
--
wrom
Printable View
Is there rTorrent/libTorrent packets for oleg firmware?
http://libtorrent.rakshasa.no/
And if not, is there any chance to build them?
--
wrom
The problem is with libsigc++ as it is badly written. Then we have problem with uclibc++. So there is little chance to get the thing working.
rtorrent is now available. Similary like with amule I have solved this problem with linking against libstdc++ and not with uClibc++. http://trac.nslu2-linux.org/optware/changeset/5371
rtorrent should work as expected. Bear in mind that this is not lightweight app like transmission as it is linked with large c++ library.
libstdc++ is delivered with latest uclibc-opt package.
Autobuild machine choked on missing reconfigure check. r5376 should solve this and you should see rtorrent, libtorrent, and libsigc++ at the top of the oleg package listing soon.
Sorry for inconvenience.
As you see in http://trac.nslu2-linux.org/optware/...ke/rtorrent.mk I do not maintan the package. Brian takes the care of it. Newer software usually means better software with many things solved. I am running unstable Debian linux for many many years, an I can tell you from experience that this is true.
What we need from You is to add your experience Optware Packages page and maybe some default startup scripts and configs.
This is really great news Oleg. :) I can't wait to test it. I'll compare with the load and cpu graphs from transmissiond and let you know how rtorrent makes out.
Ok, I have always preferred stable versions, my experience from linux started about 10 years ago, tough mipsel arch is new for me.
I use rtorrent inside of screen with nice -n 19, working fine for my taste.
It's simple, i just save from other computer over samba .torrent and rtorrent start download it automatic.
--
wrom
wrom, what configurations have you done? Can you post the relevant config options in your rtorrent.rc? Have you changed the "tos" option to something other than "throughput"?
How do you make it automatically detect added torrent files? I'm looking at the config options but nothing seems like it does this.
I running rtorrent now without nice because download speeds dropped and that's not acceptable. Hardware sets limits how many torrents can downloaded at same time, but i think this working much better than my previous python+bittornado system.
--
wrom
I have prepared patchlevel 4 rtorrent package which include wrom config file and wrote
/opt/bin/rtor script which uses dtach for terminal deattachment. Although this rtor script
uses similar syntax as startup scripts in /opt/etc/init.d
I do not know any program that can be used as terminal emulator at system boot, so that rtorrent can act as daemon to which we can attach. The problem is that rtorrent query many (ncurses) questions about controlling terminal.Code:Usage: /opt/bin/rtor (start|stop|restart|attach)
Until then use
andCode:rtor start
restart maybe is not well written, but rtorrent does not have any pidfile or similar daemon functionality.Code:rtor attach
So no autostart at reboot until solution is found. See ticket #23.
Hi oleo,
your rtor script works like a charm, but i have a little problem with it.
After
I'm in the rtorrent gui. But somehow the keys are not the same as they where if I start rtorrent manually without your script. The arrow keys can now used to change dl/ul speed instead of showing torrent details. For torrent details I have to press ctrl+right_arrow instead of pressing only right_arrow. I don't know why, but this happens not if I start your Script and attach rtorrent in one commandCode:rtor start
rtor attach
After that everything is fine.Code:rtor start && rtor attach
So I altered the Line in your script from:
to:Code:dtach -n ${RTORRENT_SOCKET} rtorrent -n -o import=${RTORRENT_CONF}
There is surely a better way, but for the moment it works.Code:dtach -n ${RTORRENT_SOCKET} rtorrent -n -o import=${RTORRENT_CONF} && rtor attach
Thanks for the great work on rtorrent.
Greetz Jeremia
I ´m sorry, but can someone write how can i install extra packages for use my WL500g.Deluxe as a bittorrent client? :confused:
There is a script which can be used to run rTorrent on system startup suggested here: http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks
So, I have slightly modified it and put in /opt/etc/init.d/S99rtorrent
It starts rtorrent as user p2p with configuration file located in /opt/etc/rtorrent.conf and working directory /opt/share/torrent
PHP Code:
# !/bin/sh
#############
###<Notes>###
#############
# This script depends on screen.
# For the stop function to work, you must set an
# explicit session directory using absolute paths in your rtorrent.rc.
# If you typically just start rtorrent with just "rtorrent" on the
# command line, all you need to change is the "user" option.
# Attach to the screen session as your user with
# "screen -dr rtorrent". Change "rtorrent" with srnname option.
##############
###</Notes>###
##############
#######################
##Start Configuration##
#######################
# You can specify your configuration in a different file
# (so that it is saved with upgrades, saved in your home directory,
# or whateve reason you want to)
# by commenting out/deleting the configuration lines and placing them
# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would
# have written them here (you can leave the comments if you desire
# and then uncommenting the following line correcting the path/filename
# for the one you used. note the space after the ".".
# . /etc/rtorrent.init.conf
#Do not put a space on either side of the equal signs e.g.
# user = user
# will not work
# system user to run as (can only use one)
user="p2p"
# the full path to the filename where you store your rtorrent configuration
# must keep parentheses around the entire statement, quotations around each config file
#config=("/home/${user}/.rtorrent.rc")
config=("/opt/etc/rtorrent.conf")
# Examples:
# config=("/home/user/.rtorrent.rc")
# config=("/home/user/.rtorrent.rc" "/mnt/some/drive/.rtorrent2.rc")
# config=("/home/user/.rtorrent.rc"
# "/mnt/some/drive/.rtorrent2.rc"
# "/mnt/another/drive/.rtorrent3.rc")
# set of options to run with each instance, separated by a new line
# must keep parentheses around the entire statement
#if no special options, specify with: ""
options=("-n -o import=/opt/etc/rtorrent.conf")
# Examples:
# starts one instance, sourcing both .rtorrent.rc and .rtorrent2.rc
# options=("-o import=~/.rtorrent2.rc")
# starts two instances, ignoring .rtorrent.rc for both, and using
# .rtorrent2.rc for the first, and .rtorrent3.rc for the second
# we do not check for valid options
# options=("-n -o import=~/.rtorrent2.rc" "-n -o import=~/rtorrent3.rc")
# default directory for screen, needs to be an absolute path
#base="/home/${user}"
base="/opt/share/torrent"
# name of screen session
srnname="rtorrent"
#######################
###END CONFIGURATION###
#######################
PATH=/opt/local/bin:/opt/sbin:/opt/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="rtorrent"
NAME=rtorrent
DAEMON=/opt/bin/$NAME
SCRIPTNAME=/opt/etc/init.d/S99rtorrent
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
checkcnfg() {
for (( i=0 ; i < ${#config[@]} ; i++ )) ; do
if ! [ -r "${config[i]}" ] ; then
echo "cannot find readable config ${config[i]}. check that it is there and permissions are appropriate">&2
exit 3
fi
session=$(cat "${config[i]}" | grep "^[[:space:]]*session" | sed "s/^[[:space:]]*session[[:space:]]*=[[:space:]]*//")
if ! [ -d "${session}" ] ; then
echo "cannot find readable session directory ${session} from config ${config[i]}. check permissions">&2
exit 3
fi
done
}
d_start() {
logger "Starting."
[ -d "${base}" ] && cd "${base}"
stty stop undef && stty start undef
su -c "screen -ls | grep "\.${srnname}[[:space:]]" > /dev/null" ${user} || su -c "screen -dm -S ${srnname}" ${user}
for (( i=0 ; i < ${#options[@]} ; i++ )) ; do
sleep 3
su -c "screen -S "${srnname}" -X screen rtorrent ${options[i]}" ${user}
done
}
d_stop() {
for (( i=0 ; i < ${#config[@]} ; i++ )) ; do
session=$(cat "${config[i]}" | grep "^[[:space:]]*session" | sed "s/^[[:space:]]*session[[:space:]]*=[[:space:]]*//")
pid=$(cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g")
# make sure the pid doesn't belong to another process
# skip the pid otherwise
if ps -A | grep ${pid}.*rtorrent > /dev/null ; then
kill -s INT ${pid}
fi
done
}
checkcnfg
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Included into optware with http://trac.nslu2-linux.org/optware/changeset/6061
Please report any problems with script here!
Cool to hear rtorrent has been packaged!
Any chance the DHT patch could be included in the package?
See: http://tk.ttdpatch.net/~jdrexler/dht/
This will give trackerless torrents functionality.
thanks,
Pim.
here is updated version of S99rtorrent:
It is a little simplified, so that is it uses only one configuration file and only one line with options. Now it conforms to /bin/sh sintaxis and works reliably during startup.
UPDATE 1/2008: I keep this script for historic reference only, as current version of S99rtorrent included in the optware package has even better S99rtorrent. However, the microhowto below applies also to a new standard version.
Here is a short instruction how to use rtorrent by user another than root.PHP Code:
#! /bin/sh
# This script depends on screen.
# For the stop function to work, you must set an
# explicit session directory using absolute paths in your rtorrent.rc.
# If you typically just start rtorrent with just "rtorrent" on the
# command line, all you need to change is the "user" option.
# Attach to the screen session as your user with
# "screen -dr rtorrent". Change "rtorrent" with srnname option.
# See http://libtorrent.rakshasa.no/wiki/RTorrentCommonTasks
# Do not proceed unless some apps are available.
test -x /opt/bin/screen || exit 0
test -x /opt/bin/su -o -x /bin/su || exit 0
#######################
##Start Configuration##
#######################
# You can specify your configuration in a different file
# (so that it is saved with upgrades, saved in your home directory,
# or whateve reason you want to)
# by commenting out/deleting the configuration lines and placing them
# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would
# have written them here (you can leave the comments if you desire
# and then uncommenting the following line correcting the path/filename
# for the one you used. note the space after the ".".
# . /etc/rtorrent.init.conf
#Do not put a space on either side of the equal signs e.g.
# user = user
# will not work
# system user to run as (can only use one)
# Add this user to /etc/passwd
user="p2p"
# the full path to the filename where you store your rtorrent configuration
# must keep parentheses around the entire statement, quotations around each config file
#config="/home/${user}/.rtorrent.rc"
config="/opt/home/${user}/.rtorrent.rc"
#config="/opt/etc/rtorrent.conf"
# Examples:
# config="/home/user/.rtorrent.rc"
# set of options to run with each instance
# if no special options, specify with: ""
# if rtorrent is started without options it will read it's config from ~/.rtorrent.rc
options=""
# Examples:
# starts one instance, sourcing both .rtorrent.rc and .rtorrent2.rc
# options="-o import=~/.rtorrent2.rc"
# starts two instances, ignoring .rtorrent.rc for both, and using
# .rtorrent2.rc for the first, and .rtorrent3.rc for the second
# we do not check for valid options
# options="-n -o import=~/.rtorrent2.rc" "-n -o import=~/rtorrent3.rc"
#options="-n -o import=/opt/etc/rtorrent.conf"
# default directory for screen, needs to be an absolute path
#base="/home/${user}"
base="/opt/home/torrent"
# name of screen session
srnname="rtorrent"
#######################
###END CONFIGURATION###
#######################
PATH=/opt/local/bin:/opt/sbin:/opt/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="rtorrent"
NAME=rtorrent
DAEMON=/opt/bin/$NAME
SCRIPTNAME=/opt/etc/init.d/S99rtorrent
# Gracefully exit if the package has been removed.
test -x $DAEMON || (logger -t rtorrent "no daemon" && exit 0)
checkcnfg() {
if ! [ -r "${config}" ] ; then
logger -t rtorrent "cannot find readable config ${config}. check that it is there and permissions are appropriate"
exit 3
fi
session=$(awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "${config}")
if ! [ -d "${session}" ] ; then
logger -t rtorrent "cannot find readable session directory ${session} from config ${config}. check permissions"
exit 3
fi
}
d_start() {
[ -d "${base}" ] && cd "${base}"
stty stop undef && stty start undef
su -c "screen -ls | grep ".${srnname}[[:space:]]" > /dev/null" ${user} || su -c "screen -dm -S ${srnname}" ${user}
sleep 3
su -c "screen -S "${srnname}" -X screen rtorrent ${options}" ${user}
su -c "screen -S "${srnname}" -p 0 -X kill" ${user}
logger -t rtorrent "started."
}
d_stop() {
session=$(awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "${config}")
pid=$(cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g")
# make sure the pid doesn't belong to another process
# skip the pid otherwise
grep rtorrent /proc/${pid}/cmdline > /dev/null && kill -s INT ${pid}
sleep 6s
logger -t rtorrent "stopped."
}
checkcnfg
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
1) Create user:
If necessary:PHP Code:
adduser p2p
2) Add the following lines to ~/.profile:PHP Code:
ipkg install adduser
tty is unfortunately also a part of coreutils :( However,. Oleg included it already in the next version of his fw (after preview 8.8)PHP Code:
alias rt='su -c "screen -r" p2p'
chmod a+rw `tty`
stty start undef
stty stop undef
Don't forget to save changes:
3) This utility requires to have installed: screenPHP Code:
flashfs save && flashfs commit && flashfs enable && reboot
and su. With su current situation is more complicated. The latest Oleg's firmware (1.9.2.7-8.7) includes /bin/su , so nothing have to be done. However if you have earlier version then su has to be installed. It is a part of adduser and coreutils packages.PHP Code:
ipkg install screen
4) Create configuration file in the p2p's user home directory ( ~/.rtorrent.rc ) based on /opt/home/rtorrent.conf
5) set correct ownership and permissions on the rtorrent working directories depending on which directories are written in ~/.rtorrent.rc file
6) when you want to attach to it use:PHP Code:
chown -R p2p:p2p /opt/share/torrent/work
chown -R p2p:p2p /opt/share/torrent/session
chown -R p2p:p2p /opt/share/torrent/dl
P.S. This script has 1 small bug/feature. An extra screen window with /bin/sh is started which can be afterwards exited manually. Up to now nobody knows how to eliminate it :(PHP Code:
rt
Please accept my apologies for my English...
My ps command hasn't any options.
[admin@suleyma root]$ ps -?
ps: illegal option -- ?
BusyBox v1.1.3 (2007.01.01-14:37+0000) multi-call binary
Usage: ps
That's the default ps that comes with the firmware, and is embedded in the flash. Install the procps package (ipkg install procps) to get a better ps.
If S99rtorrent uses ps with arguments it's a bit of an oversight. It should test what kind of ps it's dealing with. If the advanced ps becomes a requirement, the rtorrent package would have to require (or at least recommend) the procps package. Which would be a bit silly.
al37919, you don't need ps -A for that if block in your script. You can do this instead:
Code:grep rtorrent /proc/${pid}/cmdline && \
kill -s INT ${pid}
I've installed procps.
There is a mention of procps by wengi:http://wl500g.info/showthread.php?t=...unslung&page=4
Thanks for your quick response.Quote:
Cron must be in the process list (ps) after a reboot.
Remark: If you installed procps you should execute:
Êîä: ps axf
It's just that I've had my WL-500g for quite a while now and so far I've haven't felt the need for the advanced ps. Installing it just for a ps -A, which can be accomplished in a more efficient manner anyway, is a bit overkill.
I think I quite agree with you.
Look below where a short instruction how to use rtorrent by user another than root.
What do you think about:
I've done it.Quote:
ipkg install coreutils
Thanks for the comemnts. I changed the script posted above so that now it explicitly uses busybox's /bin/ps. So, there is no need now to install procps package, other than ps in it is much nicer than the standard one :)
I agree that coreutils is a big package, that should be installed here only to be able to use su. However, su is required to be able to start rtorrent as non-root user, and it is not included in our version of busybox. May be we can ask Oleg to include it in the future releases...
You dont't need install coreutils for su.
It's enough to install adduser.
I've removed coreutils now and reinstall adduser - su is working (executing).
It seems: ipkg -force-reinstall install adduser
To be on the safe side, after executed ipkg remove coreutils, I've reinstalled all installed packages by one line awk script taken somewhere from the Forum:
But now I have next records in my /opt/var/log/messages:Quote:
/usr/bin/awk '/^Package:/{system("/opt/bin/ipkg install -force-reinstall -force-defaults " $2)}' /opt/lib/ipkg/status
I think that is result executing this code:Code:Nov 2 16:00:40 admin: Starting.
Nov 2 16:00:40 su: + none admin:p2p
Nov 2 16:00:40 su: + none admin:p2p
Nov 2 16:00:43 su: + none admin:p2p
But the same was before install coreutils...Code:for (( i=0 ; i < ${#options[@]} ; i++ )) ; do
sleep 3
su -c "screen -S "${srnname}" -X screen rtorrent ${options[i]}" ${user}
done
I plan to test it as soon as possible. Of course, it depends on whether Oleg compiled rtorrent with --with-xmlrpc-c. Sure, I can compile my own and still test it, but for mass use it will still have to have it.
The entire XMLRPC support thingy is very interesting and I'm glad there are finally applications using it. Controlling rtorrent remotely would be the final bit of goodness.
Some more info:
http://rakshasa.no/pipermail/libtorr...ay/001154.html
LE: sorry, no XMLRPC support compiled in.
last version in repository has been compiled with xmlrpc support
Ah, sorry then, I must be late upgrading.
BTW, don't try setting the scgi_port option with older rtorrent builds, you'll crash them.
Any success wirespot ?
I tried this today using the lighttpd guide on this page.
After i got lighttpd running I tride the wtorrent script - but only got as far as the login-page.
Then I tried a (simpler) rtorrent web-gui called rTWi - but i could not get passed the login-page on that one either.
(some kind of user-problem right ?)
But I can feel that I am really close ;)
I even tried nTorrent - but I get an error saying "The SFTP Subsystem could not be initialized" when I connect.
Can anyone share success-stories ? :)
Well I tried something simpler. I checked that rtorrent is indeed listening on the IP and port I told it to, then I connected to that with telnet. And it doesn't do a thing, the connection dies right away.
I also tried to set up an Apache /RPC2 gateway to the router, using the Apache on my desktop machine. I figured it's better to use a full grown machine for that. But it keeps throwing 500 Server Error.
Finally, nTorrent refused to start on my machine, apparently it doesn't like my Java version.
The next step would be to install the xmlrpc command line tool on my desktop machine and try to connect with that, see if it works any better.
But I'm not in any hurry. For the time being I got rtorrent working in screen, I got it to load when the router starts or reboots, I got it to die nicely when the router goes down, I connect to the regular interface with ssh, I've setup an autoload directory and a session directory and so on. So a remote interface is not really that much of a requirement for me at this moment. I'd just as soon better write a small tutorial for setting up rtorrent itself just like I did.
A guide sounds fantastic :)
I personally think that most Asus users would switch from transmission to rtorrent if there were a simple guide for it.
I so much better ;)
Just to check - have you added:
To your .rtorrent.rc ?Code:scgi_port = localhost:5000
Without that line rtorrent does not listen for connections with xmlrpc at all.
Pulver: Yes, of course. I also checked with 'netstat -tlnp' that rtorrent is actually listening on that port.
A remote interface can be useful, especially a Web interface, in some circumstances. But it may never be as complete and easy to use as rtorrent itself. And there are multiple advantages to rtorrent running in screen over ssh: the connection will only eat up a few KB/s, it will respond promptly, it won't need additional resources over what rtorent already consumes and so on.
I'll admit at some point I was loving transmission and didn't like the idea of rtorrent, but nowadays I'm surprised to see I've changed my mind completely.
al: edit /usr/local/sbin/pre-shutdown, put this in it:Make sure pre-shutdown is executable.Code:#!/bin/sh
/bin/kill -INT $(/bin/pidof rtorrent)
Also, you need to set a session directory (session = dir) in rtorrent.rc, rehash all the torrents at least once, and restart rtorrent, for the data to enter the session files.
But to be frank I've had mixed results so far. If I kill -INT rtorrent from the command line it works as expected, when I restart it the hash will jump to 100% and download will resume immediately. But it doesn't work like that with pre-shutdown. I believe rtorrent needs a few seconds to actually dump the session data, and the router reboots before that. So try this intead (untested yet):
Try with bigger sleep intervals as well, although I read somewhere that about 5 seconds should be enough for rtorrent to do its thing.Code:#!/bin/sh
/bin/kill -INT $(/bin/pidof rtorrent) &
/bin/sleep 10
Of course, remember to do 'flashfs save && flashfs commit' to save pre-shutdown to flash!
The idea is that when I modify something in the config and need to restart the router I shouldn't have to rehash anything in rtorrent, just resume smoothly where it left off.
Yes, connection to rtorrent over ssh is really nice.
However, one thing I miss is the function to upload a torrent - direct download in rtorrent is not working with many (most) trackers.
A web-gui is also nice for places where you dont have access to ssh, such as internet coffeeshops etc.
Thanks for the info. According to http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide
So, these five seconds have a fundamental background.PHP Code:
SIGINT Normal shutdown with 5 seconds to send the stopped request to trackers.
SIGTERM Shut down immediately.
That must be it. I've tested with sleep added to pre-shutdown and now it works as intended, so that did the trick.
Pulver, for uploading torrents I've set up vsftpd and told rtorrent to watch the upload directory for files.
But you are right that there are cases where it's nicer to simply use a web browser. Not that I'd enter any private passwords in an Internet cafe computer, mind you.
BTW, here's a screenshot of rtorrent as seen over ssh, via putty running on a Nec MobilePro 900c handheld, over wireless. Gadget to gadget, so to speak. :cool:
you don't even need to open your ftp to outside, because you can transfer files through ssh also using scp or sftp protocol. Command line tools are included in putty distribution, as gui you can use, e.g. Far + WinSCP plugin
Very true. I forgot to mention that the reason I use ftp is that it's only open for the LAN. And ftp doesn't consume so much CPU like sftp or scp, which can be a factor when transferring larger files. But for torrent files it should be fine.