Want to schedule torrent downloads to occur when you are not busy using the computer?
Or are you on an internet plan where you have separate peal and off-peak quotas and would like to do your downloading during the off-peak period?
A scheduled torrent downloading program might be what you are looking for.

Most windows torrent downloading programs include scheduling functionality.

But if you have a home server which runs linux, here is a handy script for you to use to schedule your downloads.

Step 1: Get the program

In this tip, we’re using the program btlaunchmany which is part of bittorrent package.

Here’s the description of btlaunchmany from the ubuntu manpages:

btlaunchmany is a program that eases the use of managing multiple torrent downloads. The program checks the provided directory for torrent files. When it finds any, it starts a separate downloader thread for each torrent file. This program does not require a terminal to stay alive.

btlaunchmany not requiring a terminal to stay alive was the reason why it was chosen.

To install btlaunchmany on ubuntu linux, use the following command

$sudo apt-get install bittorrent

Step 2: Write the script

Copy and paste the following scripts

#!/bin/sh

TORRENT_FILE_LOCATION=”/home/username/torrentsToDownload”

echo “Starting the Handy Schedule BitTorrent Download Script”
echo “Checking for Torrent files in $TORRENT_FILE_LOCATION”

if ( test `ls -l $TORRENT_FILE_LOCATION/*.torrent | wc -l` -gt 0 )
then
echo “Executing Bittorrent Application and saving progress to torrent.log”
nohup nice btlaunchmany $TORRENT_FILE_LOCATION > $TORRENT_FILE_LOCATION/torrent_logs.log &
else
echo “No Torrent files were found”
fi

  1. Copy the above code to a new file called startScheduledTorrentDownload.sh
  2. Replace “/home/username/torrentsToDownload” in the script to the location where you will put the torrent files.
  3. Make the script executable by using the command $chmod u+x startScheduledTorrentDownload.sh

#!/bin/bash

echo “Stopping all bittorrent downloads that are currently running”
killall btlaunchmany

  1. Copy the above code to a new file called stopScheduledTorrentDownload.sh
  2. Make the script executable by using the command $chmod u+x stopScheduledTorrentDownload.sh

Step 3: Schedule the download

To get the scripts to execute automatically, you will need to add it as a cron job.

Edit the crontab file using the command $sudo nano /etc/crontab

# m h dom mon dow user  command
10 2     * * *   handyTips   /home/handyTips/scripts/startTorrentDownload.sh
0 7     * * *   handyTips   /home/handyTips/scripts/stopTorrentDownload.sh

Add the above lines to the crontab file.
The times on display there is for startTorrentDownload.sh to run at 2:10am and for stopTorrentDownload.sh to run at 7am
Replace handyTips to the user which you want the scripts to be executed as – preferably you, the owner of the scripts.
Replace the location of the scripts to where you have placed them

Finish

That’s it!

Now just put the torrent files in the directory specified in startTorrentDownload.sh and let the download happen while you’re asleep.

Never have slow internet or exceed your internet quota when downloading torrents.

note: LittleHandyTips.com do not advocate downloading illegal content using the scripts provided.
Download legally and responsibly.