Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Cron-ing rTorrent or another other CLI based BitTorrent

  1. #1
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release
    Note: The below has now been solved. Please check this link for the guide to getting it all to work nicely.


    Hi.

    I have an 8mb Down and 1mb Up ADSL line and it doesn't get used between the hours of 4am and 4pm - I would like to get the most out of it! So, I have a stand-alone server configured with "podget" to download a host of video and audio podcasts automatically and place them inside folders and setup a transcode cluster for my home DVD's - all set to begin and end at 4am and 4pm respectively. I even have TwonkyMedia setup to stream all my media to Xbox 360s and Other Media devices around the house automatically. Its also all shared via Samba to Windows and Linux machines on the network.

    However, I would like to get "rtorrent" doing the same thing. It has functions like watching a folder for new torrents and automatically begin them when they are found - all of which I have setup and got running absolutely fine - but it runs all the time and I have to be sitting at the server to stop it and start it at night (I dont wish to be using the connection too much outside of the specified hours because I have house mates that use it for gaming and the likes).

    Because it actually runs a front-end inside a GUI, it takes keyboard commands to stop and start. I have had a little run around, but found there to be no luck and no guide for doing this. I hear this kind of thing can be resolved using "screen" but I have no-idea what that is or how to use it?

    Can someone point me in the right direction to get this working (only how to stop and start rtorrent using "crontab -e") - be-it inside "screen" or by any other method, or, is there a different BitTorrent client that has its own scheduler that can be set to do the same things?

    Any help would be much apreciated.

    Hit me back with a reply or email me here.

    Thank-you in advanced!

    Horned!
    Last edited by HornedBeast; April 28th, 2008 at 05:57 PM. Reason: Solved!

  2. #2
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    nil would result in no limit... so don't set it to "0" but to "1"... that should not hurt performance at all (1kb out of 1024 upload)

    Another option would be to start/end rtorrent at given times with cron.

  3. #3
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    Thank-you for your swift reply. This nearly does what i'm after - but after a little test I discovered the it still communicates with the tracker even with the bandwidth set to 0 - thus using bandwidth during the times I'm hoping to not use any.

    If all else fails I'll have to go with this.

    Anyone else got any ideas of how to perform the OP?

  4. #4
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    You can't cron rtorrent in the usual way.

    I don't think rtorrent even worked when I added an entry in my crontab.

    It also cannot be started via "rtorrent start" and "rtorrent stop" as it isn't a service. Problem being is that its got a front end for a console and requires keyboard commands to stop it.

    The scheduler is pretty useless in rtorrent, I'd rather not use it. Cron seems to be the best way - I heard "screen" might help me... but I couldn't figure out how to use it.

    Any others?

  5. #5
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    there is an example script on how you would auto-start rtorrent in a screen.... however you can start rtorrent also in the background by issuing

    Code:
    rtorrent &
    That should also be working.

    Here's a quick guide for screen: http://jmcpherson.org/screen.html

  6. #6
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    How do I stop it via cron after that though?

  7. #7
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    why do you want to stop it at all? *g* You will have to kill the process...

  8. #8
    Join Date
    Oct 2006
    Beans
    702

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    Quote Originally Posted by HornedBeast View Post
    How do I stop it via cron after that though?
    Call me stupid, but should be a kill -15 or -9 do the trick?

  9. #9
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    Rtorrent wont even start via cron. /usr/bin/rtorrent does absolutely nothing - it certainly doesn't begin my transfers and creating a log file shows NOTHING.

    I've tried it a dozen times (I've used Cron for a long time). Its not as simple as everyone keeps suggesting - but I do appreciate your help.

    I think I may have found the answer though using Screen.

    Code:
    00 4 * * * screen -d -m rtorrent
    00 16 * * * screen -r -X quit
    Going to dry run this tonight and see what happens.

    Cheers again for your help.

  10. #10
    Join Date
    Mar 2007
    Location
    Cambridge, UK
    Beans
    141
    Distro
    Ubuntu Development Release

    Re: Cron-ing rTorrent or another other CLI based BitTorrent

    I have finally got it working absolutely fine.

    For anyone else that might need it, see this below.

    Install RTorrent via:

    Code:
    sudo apt-get install rtorrent
    Copy and paste this into /home/<username>/.rtorrent.rc replacing <username> with your current username or the user you wish to download torrents with:

    Code:
    directory = /home/<username>/Torrents/Unfinished
    session = /home/<username>/.rtorrentsession
    schedule = watch_directory,10,10,load_start=/home/<username>/Torrents/Torrents/*.torrent
    schedule = tied_directory,10,10,start_tied=
    schedule = untied_directory,10,10,close_untied=
    on_finished = rm_torrent,"execute=rm,$d.get_tied_to_file="
    on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/<username>/Torrents/Finished/ ;d.set_directory=/home/<username>/Torrents/Finished/"
    schedule = low_diskspace,5,60,close_low_diskspace=1000M
    schedule = ratio,60,60,"stop_on_ratio=100"
    check_hash = yes
    encryption=allow_incoming,try_outgoing,enable_retry

    This assumes you have the folders:

    /home/<username>/Torrents/Torrents
    /home/<username>/Torrents/Finished
    /home/<username>/Torrents/Unfinished
    /home/<username>/.rtorrentsession

    If you do not have these folders, make them now using "mkdir" or simply make them using a GUI.

    What this configuration does is check the folder "/home/<username>/Torrents/Torrents" for new .torrent files and starts them automatically and stops them if they are removed. Once the torrent has finished it is automatically moved to the Finished folder. If the torrent is still active it is found inside Unfinished. It is also set to use Encryption if it can, as this will hopefully navigate some of those nasty ISP who shape their bittorrent traffic.

    You can now run this from a terminal by running simply "rtorrent". However, to make this only start at certain times, in my case 4am until 4pm, you need to do this:

    Install "Screen" if you havn't got it already. Desktop Ubuntu does by default but Server users may need to install it:

    Code:
    sudo apt-get install screen
    Now you need to edit your crontab. You can do this by typing this at a terminal:

    Code:
    crontab -e
    Copy and paste this into it:

    Code:
    # m h  dom mon dow   command
    00 04 * * * screen -d -m rtorrent
    00 16 * * * screen -r -X quit
    The bits in bold are the hours in the 24 hour clock. The bits before that are the minutes. Simply change these to the times that suit your needs.

    What this does is start rtorrent in a "detached" screen session. Then, at 4pm, it makes screen quit any detached session. Thus giving you the desired effect.

    I hope this helps someone as i've been stubling around for weeks now.

    Horned.
    Last edited by HornedBeast; May 12th, 2008 at 01:52 PM.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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