Sharing Free software and some rtorrent

So as we all know, we now have a “Turkish National Operating System” called Pardus. (in turkish) It`s a Linux distribution not based on any other previous distribution, and with installer, config engine, package management, etc… mainly written by the developers of the Pardus project.

It has a very good turkish language support. It can be installed very quickly and easily on most of the systems. Overall it gives a good working environment for most turkish speaking computer literate person.

I like the project. I like the idea that something “popular” is at last developed by my fellow citizens. I even like the idea that the project is funded by my government. (This is very criticized, but I like it) For the year 2006 the project got a lot of attention nationwide and worldwide. The iso image of the distribution`s 2007 release has been downloaded more than 80.000 times in one month according to one of the developers. (Link is in turkish but believe me ; ) )

The bandwidth of the developing countries is always a major problem. So I decided to share some of my bandwidth with Pardus and some few other distros that I like by putting their torrents online. Especially when I`m not at home, I feel that my bandwidth is wasted by not being used. So I decided to setup on of my headless machines as a torrent client.

Since no gui was the major requirement, I wanted to go with rtorrent. This is a ncurses based torrent client and library. (LibTorrent is a BitTorrent library written in C++ for *nix, with a
focus on high performance and good code. The library differentiates
itself from other implementations by transfering directly from file
pages to the network stack. On high-bandwidth connections it is able to
seed at 3 times the speed of the official client.)

Since this would run on the network 24/7 I had some bandwidth concerns. Especially for the weekdays, I didn`t want rtorrent to use all my bandwidth and leave my main internet activity sluggish. So I came up with a timeline of my habits.

Mainly I wake up, get ready to go to work, and browse some morning mail, news, weather between 8-10 am. Then I come back home, eat, browse web, play WoW, download stupid youtube videos, etc… then go to sleep; between 5pm and 1am. (OK OK sometimes 3am 😛 )

Fortunately rtorrent has a great scheduler. Al I had to do for this is to create a .rtorrent.rc file under my home directory and add these lines in it.

schedule = Gece_limitsiz,01:00:00,24:00:00,upload_rate=37
schedule = Sabah_limitli,08:00:00,24:00:00,upload_rate=5
schedule = Sabah_limitsiz,10:00:00,24:00:00,upload_rate=37
schedule = Gunduz_limitli,16:00:00,24:00:00,upload_rate=5

Each line above creates a schedule. Let`s go by example:

schedule = Gece_limitsiz,01:00:00,24:00:00,upload_rate=37

This means create a schedule named: Gece_limitsiz (meaning Night_unlimited in turkish) which will trigger at 1 am and will sleep for 24 hours and each time it runs it will limit the upload to 37 K/s. Pretty straightforward right? : ) So next, is the one that triggers ar 8 am, and limits my upload to 5 K/s, and so on…

You can do many tricks with schedule command. Here is another good use of it. This trick is from the default rtorrent config file.

schedule = watch_directory,5,5,load_start=/home/someuser/torrent/watch/*.torrent

This one will schedule the trigger that looks for a torrent file in the directory specified (in our case: /home/someuser/torrent/watch and every file that ends with .torrent) every 5 secs. All you have to do, id to drop your torrent file to this directory each time you wanted to share/download a new torrent.

port_range = 17000-17050

This time we want to specify whic ports will our torrent client will run on. I chose 17000-17050 since this whole range was not used by any application on my rtorrent box. (Don`t forget to forward your ports to this box if you have a firewall or masquerading device in front of you!) (Note: bittorrent clients usually require one port for each torrent that you are sharing.)

Some other nice features are, being able to create symbolic links for the state of the downloads, Stop sharing a torrent after certain ratio, and many more. And the latest version adds the encryption that everybody was waiting for some time ; )

Overall, I really liked rtorrent. It`s fast, small, stable, extensible, requires minimum interaction, and does its job really well!