Ever wondered if you could schedule your torrent downloads to occur in those times when you are not using you computer, when you know that there will be more people online sharing the file your downloading, or perhaps during the off-peak times of your Internet plan Well this tutorial is for you.
1. We need to make sure that the relevant software is installed on our system. To do this we start up Synaptic Package Manager
System → Administration → Synaptic Package Manager
and search for 'bittorrent'. Select 'bittorrent' from the options and click 'Apply' to install it with all of its dependencies. If you've already got bittorrent installed then it will already be selected in the list and you won't need to perform this step.
2. Next we need to create the directory that we will download our torrents into. You can use any directory that you have permission to use for this this but a sub-directory in your home directory will often make things easier. For this tutorial I will be using a sub-directory in the user's home directory called 'torrents'. To create this directory simply navigate to your home directory
Places → Home Folder
right click on some empty space and select 'Create Folder'. Name this folder 'torrents'.
3. To automate the task of downloading torrents, and stopping the downloads at an appropriate time, we are going to create some very simple bash scripts (For more on bash scripts see here). We will use the familiar graphical text editor gedit for this task.
In your home folder right click some empty space and select
'Create Document' → 'Empty File'
Name this file 'bittorrentstart'. Perform this task again to create another file and call this one 'bittorrentstop'. You can place these files anywhere you like, perhaps in a directory called 'scripts', but this tutorial will assume they are in your Home directory.
Double click the file 'bittorrentstart' to open it and paste in the following information
#!/bin/sh
# Start Downloading Torrent Files!
cd
nohup btlaunchmany /home/Your_User_Name/torrents/ > torrent.log &
tail -f torrent.log
Make sure you change the 'Your_User_Name' to your user-name. Save this file, open 'bittorrentstop' and paste in the following information
#!/bin/bash
# Stop Downloading ALL Torrent Files!
killall btlaunchmany
4. The second part of automating the downloading of torrents is to tell our computer when to execute the start script and execute the stop script. To do this we use a tool called cron . To make the editing of cron entries simple we are going to create a text file that we will edit in gedit (like the bash scripts above) and then append it to our cron entries.
While in your Home directory right click on some empty space and select
'Create Document' → 'Empty File'
Name this file 'cron.txt'. Double click this file to open it and enter in the following information
# Start BitTorrent Download Script
05 02 * * * sh /home/Your_User_Name/bash_scripts/bittorrentstart.sh
# Stop ALL BitTorrent Downloads Script
55 11 * * * sh /home/Your_User_Name/bash_scripts/bittorrentstop.sh
Be sure to enter your user-name in the required fields. This setup will start the download start script at 2:05am and start the download stop script at 11:55am. These values will likely not suit you so you need to alter them. To understand the format of cron entries picture five asterisks at the start followed by your command. Something like the following
* * * * * sh /home/Your_User_Name/bash_scripts/bittorrentstart.sh
The first asterisk represents minutes, the second hours, the third days of the month, the fourth is the month, and the fifth the day of the week. The allowed syntax is
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or the month names)
day of week 0-7 (0 or 7 is Sun, or use the weekday names)
Save this file and start up your terminal emulator
Applications → Accessories → Terminal
Enter in the following command
crontab cron.txt
To verify that this was entered into your cron entries properly enter in the following command
crontab -l
5. Now that we've installed the relevant applications and told the computer to execute the appropriate tasks at the appropriate times all we need to do is save our *.torrent files into the bittorrent directory we created earlier and wait. At the appropriate times they will be downloaded into their own sub-directory without you even being aware.
6. In the bittorrentstart script we created earlier there is a command to create a log file. This file records the activity of the torrent downloads. This file, called 'torrent.log', will be found in your Home directory. You can simply open this file to check on the status of your downloads. A sample line from this log file is
/home/Your_User_Name/torrents/torrent_name: Spd: 34.0 K/s:18.2 K/s Tot: 171.2 M:61.1 M [18:10:07 76%]
All: Spd: 34.0 K/s:18.2 K/s Tot: 171.2 M:61.1 M
What all of these entries mean is beyond the scope of this tutorial but you can easily recognise your connection speed and the percentage finished of your torrent downloads.
Feed