Page 3 of 3 FirstFirst 123
Results 31 to 44 of 44

Thread: rTorrent and libTorrent

  1. #31
    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 ?

  2. #32
    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.

  3. #33
    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:

    Code:
    scgi_port = localhost:5000
    To your .rtorrent.rc ?

    Without that line rtorrent does not listen for connections with xmlrpc at all.

  4. #34
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,805
    Quote Originally Posted by wirespot View Post
    I got it to die nicely when the router goes down
    This is of interest to me, could you share your experience, pls.

  5. #35
    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:
    Code:
    #!/bin/sh
    /bin/kill -INT $(/bin/pidof rtorrent)
    Make sure pre-shutdown is executable.

    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):

    Code:
    #!/bin/sh
    /bin/kill -INT $(/bin/pidof rtorrent) &
    /bin/sleep 10
    Try with bigger sleep intervals as well, although I read somewhere that about 5 seconds should be enough for rtorrent to do its thing.

    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.
    Last edited by wirespot; 03-12-2007 at 16:04.

  6. #36
    Quote Originally Posted by wirespot View Post
    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.
    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.

  7. #37
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,805
    Thanks for the info. According to http://libtorrent.rakshasa.no/wiki/RTorrentUserGuide
    PHP Code:
     SIGINT      Normal shutdown with 5 seconds to send the stopped request to trackers.
    SIGTERM     Shut down immediately
    So, these five seconds have a fundamental background.

  8. #38
    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.
    Attached Images Attached Images  

  9. #39
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,805
    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

  10. #40
    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.

  11. #41
    Just a quick update: mancub has written a tutorial for setting up XMLRPC in lighttpd and using that with rTorrent and a GUI of your choice:
    http://www.wl500g.info/showthread.php?t=12110

    There are several GUI's, google for "rtorrent gui" or see the wikipedia page. I use rtGui on my desktop machine, I've set it to connect to lighttpd on the router over LAN. It allows you to add torrent files too! But you'll need a webserver on your desktop too for rtGui (I run Linux on the desktop as well so it wasn't much of a problem). I have no idea how well rtGui runs on a webserver installed on Windows.

    So, now I have rtorrent with XMLRPC connected to lighttpd, both on the router, and the GUI on the desktop, which makes sense, because usually these clients are based on PHP or other stuff that is too heavy for the router.

    The only problem left for me now is to figure out how to obtain a simple lightweight command line xmlrpc client. The xmlrpc-c package apparently has only the library. The purpose is to be able to query rtorrent for total bytes transferred up/down from a shell script and input that data into RRDTool. I already got graphs going that show total bytes transferred in/out of the route, it would be very interesting to be able to see how much of that is P2P.

  12. #42
    I couldn't compile the xmlrpc client from the xmlrpc-c source package, got all kinds of errors until I gave up. Another possibility was to write a client in PHP but it runs slow as hell; plus PHP on the Asus doesn't have xmlrpc libs and I'd have to use all kinds of third party libs and it gets really annoying.

    So the hell with all the xmlrpc crap. I figured out what lighttpd expects to receive at the special "/RPC2" url you set up (see mancub's tutorial). Which is this:

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <methodCall>
    <methodName>d.multicall</methodName>
    <params>
     <param>
      <value>
       <string>main</string>
      </value>
     </param>
     <param>
      <value>
       <string>d.get_down_total=</string>
      </value>
     </param>
     <param>
      <value>
       <string>d.get_up_total=</string>
      </value>
     </param>
    </params>
    </methodCall>
    To make use of it, you put it in a file, let's call it "post.txt" then you can simply use wget (ipkg install wget) like this:

    Code:
    wget -T10 -q --no-check-certificate --post-data=post.txt -O - http://localhost/RPC2
    Replace localhost/RPC2 with the address you've set up your lighttpd with. -T10 means to timeout after 10 seconds. -q means to be quiet (no progress bar). --no-check-certificate is useful if your lighttpd uses SSL. --post-data tells wget where to get the stuff above. -O - means to output what it gets back on the console, so you can pipe it to something else, replace - with a file name if you like that better.

    This is what wget should return if everything was set up properly:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <methodResponse>
    <params>
    <param><value><array><data>
    <value><array><data>
    <value><i8>4271258199</i8></value>
    <value><i8>1437056179</i8></value>
    </data></array></value>
    <value><array><data>
    <value><i8>4271258199</i8></value>
    <value><i8>1437056179</i8></value>
    </data></array></value>
    <value><array><data>
    <value><i8>4271258199</i8></value>
    <value><i8>1437056179</i8></value>
    </data></array></value>
    <value><array><data>
    <value><i8>4271258199</i8></value>
    <value><i8>1437056179</i8></value>
    </data></array></value>
    </data></array></value></param>
    </params>
    </methodResponse>
    Obviously, the values will be different each time you do this. But you'll notice that all four value sets are identical, so you can use only the first set. I dunno why rtorrent does that but I had 4 torrents running so it may be that.

    Don't worry, the values you get this way are good. I've checked against the overall WLAN transfer numbers and against the limits I've set in rtorrent, and they match.

    So, all you need to do next is use shell commands to extract those two values from there, then you can use them with rrdtool or whatever.

    If anybody has some cool sed or awk magic they can use to extract them, please tell us. For now, all I've been able to come up with is this:

    Code:
    wget bla bla bla |\
    grep i8|sed 's/[^0-9]//g'|tr '[:space:]' ' '|awk '{print $1":"$2}'
    This will print the numbers separated by colons, good to be sent directly to rrdtool. If you want something else adjust as needed.

    What happens here: I select only the lines with "i8" on them, 'cause I know they have the numbers. Then I strip everything but the digits. Then I put everything on the same line. Then I extract the first and second things on the line.
    Last edited by wirespot; 09-07-2008 at 16:14.

  13. #43
    Quote Originally Posted by al37919 View Post
    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
    Hey, al37919, when you do "screen -S rtorrent -X screen rtorrent" what you're doing is creating a new screen window window with the rtorrent program running on it. There is window #0 and then you are creating window #1 with rtorrent attached. If you want to get rid of that extra window (window #0), you can do two things:

    1) Send an stuff command to screen, with rtorrent and the carriage return code (Control-M). With -p 0 you select the window #0 and stuff sends the parameter string to that window:

    Code:
    screen -S rtorrent -p 0 -X stuff 'rtorrent^M'
    2) Send the kill command to the same window:

    Code:
    screen -S rtorrent -p 0 -X kill
    The second command can also be used to kill the window after rtorrent exits, if you want to.

  14. #44
    Join Date
    Feb 2007
    Location
    Moscow, Russia
    Posts
    3,805
    Hi! Thanks for the advice, I've somehow missed this message. Now I tested both possibilities:

    Thing #1 unfortunately is not completely effective. Using it we really have only single window #0 in the session, however the junk /bin/sh process is still sitting in the 'ps aux' output. Killing of this /bin/sh naturally kills both rtorrent and screen.

    Thing #2 seems to solve the issue. If we add it at the end of the d_start() function we get rtorrent started without annoying process in the memory. Exiting of the rtorrent results in termination of teh screen session.

    Thanks a lot again,
    al
    Last edited by al37919; 13-10-2008 at 16:19.

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •