| Home | Community | Message Board |
|
You are not signed in. Sign In New Account | Forum Index Search Posts Trusted Vendors Highlights Galleries FAQ User List Chat Store Random Growery » |
This site includes paid links. Please support our sponsors.
|
| Shop: |
| |||||||
|
God Registered: 10/27/09 Posts: 7,512 Loc: Philadelphia, PA |
| ||||||
|
I posted this howto on my blog and thought someone might be interested..
Introduction: RTorrent is a bittorrent client for Linux. It may be possible to install on OSX via Fink or Macports but I don't have an Apple machine to test this. RTorrent is a text based application which means you interact with it entirely from the command line. ![]() Why would you want to use an application like this? Well, RTorrent is extremely lightweight and flexible. I use this setup on my home server and my laptop. Both are run from within a screen session. With this configuration, torrents will automatically download into the appropriate directories (TV, Movies, Music, etc) for easy organization. Once the download is finished on the server, RTorrent sends an SMS message to my cell phone telling me the download has completed. RTorrent also sends a popup message to my desktop when downloading directly on the laptop. I have no need for this on the server as it operates without a monitor at all. In this howto I'll walk you through how to set up all those options plus a little more. There are graphical addons you can use with RTorrent, specifically ruTorrent, wTorrent, and Transdroid, but I will not be covering these as they are largely unnecessary as long as you have an SSH connection to the server. To use a GUI frontend to RTorrent you will need to compile with support for XML-RPC and enable XML-RPC in Apache or Lighttpd or whatever. OK.. lets get down to business. To start RTorrent, you open a terminal and simply run "rtorrent" without the quotes. Out of the box it works but it doesn't work exactly the way we want it to. Going to have to tweak some options. Lets close RTorrent and we'll run it later. To close RTorrent, hold Ctrl and push the q key. Initial Configuration: Open RTorrent’s configuration file located at ~/.rtorrent.rc with whatever your text editor is. "gedit .rtorrent.rc" if you run Gnome. "kedit .rtorrent.rc" if you run KDE. First thing you'll want to do is set up your port forwarding information. Edit this line with whatever you are using for port numbers: Code: port_range = XXXX-XXXX Next, you’ll probably want to set up a watch directory. The watch directory is where RTorrent will watch for new .torrent files. If a new .torrent file is found then it is automatically added to the download queue. I like to add a hidden folder called .torrents/ and use that as my watch directory. This line: Code: schedule = watch_directory_movie,5,5,load_s will watch the ~/.torrents/ directory and automatically download to the default directory that you specify in this line: Code: directory = /home/user/torrents You could also use this syntax: Code: schedule = watch_directory_music,5,5,"load_ The section that says "watch_directory_music" can be anything you want, make it descriptive of what you are defining. The "load_start=" section will watch for new .torrent files in ~/Music/.torrents Finally, the "d.set_directory=" section defines an alternate download directory than the default one defined above. In this case we will be downloading to ~/Music. This method for defining alternate download directories is only available on versions 0.7.7 and above. So now, to download a music album you just put the .torrent file in ~/Music/.torrents and the files will automatically download to ~/Music. Change them as you see fit for Movies, TV, etc.. Notifications (optional): SMS: This section will show you how to set up your computer so that it will send you an SMS message to your cell phone when a download completes. This will be done with heirloom's mailx package. Essentially, RTorrent will call a script when a download completes that will send an email to your cell phone provider (Sprint, T-Mobile, etc). That email is then translated into an SMS message and forwarded to your phone. Heirloom's mailx package is a very simple application to send an email. You could use the standard mailx package with sendmail or whatever else if you already have it setup.. heirloom's is just easier and faster because it sends messages directly without a need for sendmail at all. I’m sure it works with an email service other than GMail but I don’t use any other service so I don’t know what they require. Please let me know the correct information for other email services if you know what they are. For mailx you’ll just need to save the following information to the /etc/nail.rc file, add your GMail username and password settings and you should be good to go. Code: set smtp=smtp.gmail.com:587 That does it for mailx. Now we will need a script to actually send the SMS. I saved this to ~/scripts/mail.sh but you can put it wherever you want. Edit your information for your cell phone provider. Disclaimer: This works in the United States, I don’t know about the rest of the world. Code: #!/bin/sh dont forget to make this script executable: Code: chmod +x mail.sh This will send an SMS message that looks like this: Code: Title of torrent: Done DBus: DBus notifications are the little system messages that popup on your Linux desktop (Wireless Connected, Battery Low, etc). This is done through DBus and libnotify. Chances are if you are running a GUI desktop environment of any kind you already have libnotify installed. If not it should be in your package manager. To test and make sure you have it run this command: Code: notify-send "This is your title" "And here is the body" You should see a popup notification on your desktop, title over body. Now there may be a way to send the command directly from RTorrent but I decided to just use the same type of script I used for the SMS message. OK so first, make a file named notify.sh and put it into a dir in your PATH. then add this to the file: Code: #!/bin/sh You can change the first part to whatever you like. This will be the title of the notification bubble. The second part, $1, is the variable for the torrent name. Don’t change it. and dont forget to make this script executable: Code: chmod +x notify.sh Enabling notifications: Now that you have all the other config files in place and running you’ll need to tell RTorrent when to call the scripts and where to find them. That is all done in these lines: Code: # for SMS message Notice the notify_sms and notify_dbus sections. these are the command identifiers. They can be anything you like. They just need to be unique values. and obviously, you’ll need to change the execute path to wherever you put mail.sh and/or notify.sh. Other than that you should be OK. This should work on all 0.8.x versions. I think the syntax is a little different for 0.7.x but im not 100% sure. It is definitely still possible though. Screen: Screen is basically a window manager for the command line. You start your application in a screen session, disconnect from that session, and reconnect later. At its basic level it allows you to run an application in the background but it is much more powerful than that. Ideally, you are going to want to run RTorrent within screen all the time. Its not necessary but this way youre able to close the window and still continue to download. If you want to use the RSS feed stuff I have below it is pretty much required. Before starting screen, lets add some options to the configuration file. Add the following to ~/.screenrc Code: bindkey -d -k db stuff "\010" You don't really need to worry about all the options right now.. just trust me. The "hardstatus" line gives you a little status bar at the bottom of the terminal you have open giving you a bunch of different information, most importantly, what "windows" you have open. This makes navigation within screen a lot easier and helps you identify when you are or aren't in a screen session. You can see an example of this in the Newsbeuter pic I posted below. Now lets play around with it a little bit.. Open a terminal. Run "screen" without the quotes. You should see the status bar at the bottom telling you the machine name, time, etc. The section in the middle of the status bar is the windows you have open. By default it should say something like "1*bash". Now type a bunch of stuff, it doesn't matter what it is. After you do that, hit this key combo: Ctrl+a then press the d key. This should have disconnected you from the screen session so you are back at your normal terminal. To reconnect to screen just run the following: "screen -r" Now you should see all the random text you added before. Screen will run as long as there are open terminals, or "windows", within it. Closing that single window by typing "exit" will shut down screen. Go ahead and do that.. we're going to make a few changes next. We will be running RTorrent from within screen from now on. Run "man screen" to read more about the key bindings and other screen options you may be interested in. Automation Start rtorrent/screen session on boot First thing we are going to do is start RTorrent automatically when screen is launched. Add the following line to the end of ~/.screenrc Code: screen -t rtorrent 9 rtorrent This will automatically start RTorrent within screen when it starts, name the "window" rtorrent, and designate that window as window number 9 (more on window numbers later). Now, to start screen at boot, you could do it by adding an ugly hack to your window manager startup applications or in .xinitrc like "xterm -e screen" but that will launch a terminal window you will have to close every time you log in. That gets annoying very quickly. The following method is more proper and much cleaner. As root, open up /etc/rc.local with your favorite text editor. Add this line to the end: Code: su USERNAME -c 'screen -d -m' Now when you first start the computer you can open a terminal and type "screen -r" and find your screen session and see RTorrent has already started in the background. TV show feeds For automatically downloading TV shows I use the public bittorrent site at http://ezrss.it. Search for the show that you want to subscribe to, then refine your search based on quality and/or release group. Once you see the feed the way you want it, click the "Search-based RSS Feed" link. This will give you a customized feed to your show. This can be done with a global RSS feed and filters on sites like The Pirate Bay but I find this a lot easier. Now for the feed reader. You could probably use any feed reader that you want as long as it supports downloading rss enclosures. If a GUI application supports .torrent downloads then it usually tries to act as the bittorrent client also (gpodder, miro, etc). The only good GUI feed reader I’ve used in the past without any problems is Liferea. Liferea is great but it doesn't work if you are building a totally headless server. bash/mashpodder will not download .torrent files. rssdler is supposed to work but it does not offer an ncurses UI. Newsbeuter is my preferred feed reader. ![]() Install Newsbeuter through whatever package manager you use. Add this to ~/.newsbeuter/config Code: auto-reload yes The only changes you should really need to make is for the browser and reload-time. reload-time is the frequency Newsbeuter will update itself. I have it set for every 30 minutes. Leave everything else the way it is. Now lets add some feeds. The Newsbeuter feeds are stored in the ~/.newsbeuter/urls file. All you need to do is put the url of the feed into this file, save and exit. The feeds from ezrss.it are all named the same thing though. You'll want to manually define the feed title so you know what you are updating. To do that just add the title to the end like this: Code: http://this-is-the-feed.com/fee That should be it for adding your feeds. To use Newsbeuter just run "newsbeuter" in a terminal to start it. Push the q key if you want to exit. The only problem with Newsbeuter is that it will automatically queue the file for download but it does not actually download the .torrent file.. it just queues it for me to manually start the download. This takes away from the automation. Fortunately, I’ve hacked together a script that will start the downloads without any user intervention. Save this script wherever you want. I named it downtor. Code: #!/bin/sh The first line changes to the directory where the .torrent files will be downloaded to. The next line copies the urls from Newsbeuter's queue file format and puts it into a simpler text file. The third line actually downloads the files. The last line clears the queue so it is empty for the next update. You’ll need to create a few files for this script to work properly. Run these two commands: Code: cd ~/.newsbeuter Don’t forget to make downtor executable: Code: chmod +x downtor I'm sure there is a neater way to accomplish the same thing but i don't really care. I'm not a programmer and this works well enough.. it's only 4 lines of bash. Now to have this script execute at regular intervals you will need to set up a cron job (chances are you already have cron installed). Cron is basically just a way to schedule tasks. To set this script as a recurring action, you want to run: Code: crontab -e This will open your crontab file where you can specify scheduled tasks. This will probably open the file with vi. Hit the i key. Now you want to add a line like this: Code: */0 * * * * /usr/bin/downtor That will run the downtor script every hour of every day. See the cron documentation if you want to customize the scheduling further. To save this file, hit the Esc key a bunch of times and then type ":wq" without the quotes and hit Enter. If you messed up and can't figure out the key bindings for vi then hit Esc a few times and type ":q!" without the quotes and hit Enter. This will close without saving so you can try again.. So we have Newsbeuter all set up properly but there is one problem, it won't start at boot. To enable that we will just start it the same way RTorrent is started. Edit ~/.screenrc and add the following line: Code: screen -t newsbeuter 1 newsbeuter Now both Newsbeuter and RTorrent will be started within screen at boot in different "windows". To switch back and forth between Newsbeuter and RTorrent within screen use this keybinding: Ctrl+a then push the n key for "next window". If you want to create a new window in screen and start Newsbeuter manually, hit Ctrl+a then push the c key to "create window". Then just run newsbeuter like you would normally. Automatic ratio handling I get most of my torrents from private trackers. On a private tracker, I would want the completed download to seed for as long as possible so I can keep my share ratio as high as possible. I don’t focus quite as much effort to public trackers because 1.) there is little incentive for me to do so and 2.) I would rather use the bandwidth on private trackers. The torrent files I get from the rss feeds listed above are all from public trackers. Since the torrents download automatically without any user intervention, they should also stop seeding automatically when a certain ratio has been reached without any user intervention. To do this we are going to have to set up a group and define the rules for any torrents put into that group. We will be doing all of this configuration in RTorrent’s ~/.rtorrent.rc file. First, define the group: Code: group.insert_persistent_view = TV_group Now, we have to define our ratio rules: Code: group.TV_group.ratio.enable= With the rules listed above the torrent must seed to at least a 1.00 ratio. After that it will stop when the ratio hits 3.00 or you have uploaded 200MB, whichever comes first. The rules have been defined so now we need to tell RTorrent what to do with the files once it reaches those limits: Code: system.method.set = group.TV_group.ratio.command, d.close=, d.erase= These options will stop the torrent from seeding and remove it from the RTorrent session. Next, we need to specify the watch directory where these rules will be applied. Code: schedule = watch_directory_TV,5,5,"load_sta That’s it! Now when a new TV show is put into the feed:
All of this happens without you doing ANYTHING. It is all automatic. Please let me know if I wasn’t clear enough when describing this. It makes sense to me but I could be talking in circles. More options for ratio handling can be found in the RTorrent wiki. Conclusion: RTorrent is a really nice, no nonsense type of client. Using a text-based application usually has a little bit of a learning curve compared to its GUI counterpart. I really don’t think there is any better of an application that is worth putting the effort into learning. RTorrent is simply amazing. That should be it. If you see anything in here that is incorrect or isn’t quite worded clearly enough please feel free to let me know and I’ll see if I can help. Happy torrenting and best of luck. -------------------- ![]() Edited by frith (10/11/10 03:11 AM)
| |||||||
|
nostalgic sci-fi Registered: 08/09/10 Posts: 802 Loc: In your mind |
| ||||||
|
wow. nice turtorial I guess. Seems like a bit of a hustle to getting a text message etc each time you download something, even though that is an option. This would be for the people with special needs.. Whats wrong with uTorrent? : ) ligthweight as hell, hell, even easy to use.
-------------------- ![]()
| |||||||
|
God Registered: 10/27/09 Posts: 7,512 Loc: Philadelphia, PA |
| ||||||
|
RTorrent is more flexible. it takes some time to learn it but the rewards are a lot greater.
also, uTorrent is closed source. i try to avoid closed software as much as possible. as for the SMS messages, i dont think people generally download so much to the point that SMS would get annoying. ill go a week without a message but then on days when a few TV shows are released ill get 2 or 3 at a time. i dont think thats a big deal. ![]() SMS allows me to ignore the machine all together and have the updates pushed into my day-to-day activities. it all about automation
-------------------- ![]()
| |||||||
|
I Am Moron! Registered: 11/27/05 Posts: 6,557 Loc: 41.90231, 12.453 Last seen: 1 month, 2 days |
| ||||||
|
Thats pretty awesome, didn't read it all but from what I understand there are some awesome perks.
I'll probably save this tut for when I'm financially able to set up a home server for this. Just so I understand are you saying that you can dwonload torrents into multiple specific folders. Like an album into a music folder and a movie into the movie folder, or is it just one folder it dumps all torrents into? -------------------- Customize your Shroomery experience! Do not argue with an idiot. He will drag you down to his level and beat you with experience. Edited by Idiot (11/10/10 10:20 AM)
| |||||||
|
God Registered: 10/27/09 Posts: 7,512 Loc: Philadelphia, PA |
| ||||||
yep. movies are put in the movie folder. music in music.. etc.. i dont have a general download folder. everything goes where its supposed to. the automatic tv show downloads and sms notifications are amazing too. -------------------- ![]()
| |||||||
|
FPSnosurrender Registered: 02/13/09 Posts: 3,720 |
| ||||||
|
Having trouble with this. If there's any ideas... Everything is going good except for newsbeuter and how Frith seperate his newsfeed by shows..
You guys get that???
| |||||||
| |||||||
| Shop: |
|
| Similar Threads | Poster | Views | Replies | Last post | ||
![]() |
HOWTO: HTPC done right | 1,045 | 4 | 11/29/10 07:24 PM by frith | ||
![]() |
Configuring my own DNS | 1,034 | 6 | 10/15/06 11:59 AM by Cepheus | ||
![]() |
so I finally decided to try and configure dhcp3-server in linux again, and am confused as ever | 572 | 2 | 03/04/12 07:01 PM by cokane | ||
![]() |
active directory is corrupt, how do I restore it, THANKS ( |
3,457 | 30 | 10/11/11 09:51 PM by imachavel | ||
![]() |
Re-configured my entire home network | 408 | 1 | 04/05/15 05:26 AM by micro | ||
![]() |
Microsoft exam 70-680: TS: Windows 7, Configuring | 1,221 | 11 | 09/04/11 02:40 PM by DNArobots | ||
![]() |
Squid authenticating against Win2K Active Directory | 501 | 0 | 07/12/06 11:33 AM by FlusH | ||
![]() |
Unlocking a windows directory? | 1,561 | 12 | 04/13/07 05:01 AM by OJK |
| Extra information | ||
| You cannot start new topics / You cannot reply to topics HTML is disabled / BBCode is enabled Moderator: trendal, automan, Northerner 3,017 topic views. 0 members, 25 guests and 1 web crawlers are browsing this forum. [ Show Images Only | Sort by Score | Print Topic ] | ||





