Scheduling Automatic Torrent Downloads with uTorrent

Sunday, February 3, 2013

Scheduling Automatic Torrent Downloads with uTorrent

This post is primarily applicable to those people with a limited download broadband connection with unlimited transfer during specific hours of the night.

I have broadband plan with unlimited downloads during 2 AM to 8 AM. I will be sleeping during this period. I want my PC to start at 2 AM, do my torrent downloads and shutdown at 8 AM without even a single keystroke.

Here is how...

There are actually three parts to this:

1. Starting the PC and torrent download.
2. Stopping any download happening outside of the allotted time slice
3. Shutdown/hibernate PC after download, only if I am sleeping!

This will work in Windows XP / Windows Vista / Windows 7 with minimal tweaks. Actually, this is applicable to Linux also, but with different tools.

Tools of the trade:

- Windows/Linux : normally allows the machine to be started based on a schedule
- uTorrent : easiest so far
- Windows Task Scheduler / Linux initrd : scheduling stuff

Let's do this...

1. Starting the PC and torrent download

New PCs (I mean, less than 5 years old) have capability to boot automatically at a specific time. Some even allow this directly from the BIOS. If not, Windows supports this as part of Task Scheduler.

Windows Task Scheduler : Wake up

1. Open Task Scheduler.

- Click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.

2. Create a new task.

- In Windows XP:

- Click "Add Scheduled Task"

- In Windows 7:

- Click Action -> Create Task

3. Schedule uTorrent

- In Windows XP:

- Click Next

- Click Browse and select uTorrent.exe. Click Next

- Select "Daily". Click Next

- Set start time. Click Next

- Don't enter password. Click Next

- Check "Open advanced properties for this task when I click Finish". Click Finish. If any Warning shows, just click OK.

- Modify Advanced Settings.

- In "Task" tab, check "Run only if logged on".

- In "Settings" tab. Under "Power Management", check "Wake the computer to run this task".

- Click OK.

- In Windows 7:

- Go to General tab.

- Specify a name for the task

- Check "Run only when user is logged on."

- Go to Triggers tab

- Click New

- Select Daily and choose time to start

- Make sure "Enabled" in checked

- Click OK

- Go to Actions tab

- Click New

- Choose Action as "Start a program"

- Click Browse and select uTorrent.exe

- Click OK

- Go to Conditions tab

- Check "Wake the computer to run this task"

- Make sure all other items are unchecked

- Click OK

4. Verifying the setup

- Go back to the scheduled task and set the start time as 2 minutes from current time.

- Save and hibernate the PC.

- Wait 2 minutes and see if the PC starts up again.

- If it doesn't, go back and verify all the steps.


Voila, we have takeoff...

2. Restricting any download happening outside of the allotted time slice

uTorrent comes with built-in scheduler. We are going to make use of it...

Start uTorrent

Go to Options -> Preferences (Ctrl+P) From the menu on the left, click "Scheduler". The cells represent a time slice across the week. We are going to make sure that downloads happen only from 2 AM to 8 AM everyday.

- Click on all the cells on the columns 3 through 8. Each column maps to a hour in the clock, starting from midnight. Green cell means full speed download and white cell means no download. Make the schedule by changing all the needed time slices to green. It should look like the snapshot below.

- Click Apply.


uTorrent Scheduler

That should do it... no torrent download will happen outside the time slice we have set, even if uTorrent is running...

3. Shutdown/hibernate PC after download, only if I am sleeping!

I have made sure that download happens only between 2 AM and 8 AM. Then why should the PC be on at other times? I am going to hibernate the PC when the download is done.

We are going to use the Task Scheduler to hibernate the PC. But, what if I am using the PC during 8 AM? I don't want the PC to hibernate automatically on me. So, we will use a Windows batch script... The script will prompt with a timer and you can cancel it anytime within 10 minutes...

Note: If we are going to shutdown, then we can use the timeout feature of shutdown command.

Here is the code:

@echo off setlocal enableDelayedExpansion for /l %%N in (600 -1 1) do ( set /a "min=%%N/60, sec=%%N%%60, n-=1" if !sec! lss 10 set sec=0!sec! cls choice /c:CN1 /n /m "HIBERNATE in !min!:!sec! - Press N to hibernate Now, or C to Cancel. " /t:1 /d:1 if not errorlevel 3 goto :break ) cls echo HIBERNATE in 0:00 - Press N to hibernate Now, or C to Cancel. :break if errorlevel 2 (%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate) else echo "Hibernate Canceled"

Save this as "hibernate.bat".

Note: If you want to shutdown the PC instead of hibernate, just replace '(%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate)' with '(shutdown -s -f)' in the script.

Now, for the scheduling part... as we have a 10 minute window in the script (600 seconds in the code), we need to start the script 10 minutes prior to when we need the PC to hibernate...

Do steps similar to "Step 1", except the following:

- Instead of "uTorrent.exe", choose "hibernate.bat"
- Uncheck "Wake the computer to run this task"
- Set the time to be 10 minutes before the actual hibernate time

That's it... now the PC will turn on automatically in the middle of the night, download torrents and hibernate in the morning...

Tip: If you need to connect to the internet using a command or executable, you can schedule that also same as utorrent in Task Scheduler.

Comments please...

 See also...  » Recover / Fix A Corrupt NTFS Partition

» Fixing bricked iPhone 3GS on iOS 5.1.1 without restoring

» Transparent Desktop Icon Labels in Windows XP

» Speedup Windows XP without Reinstalling, in 10 minutes!!!

» NOD32 Update Failed!!!

» Easy Hibernate in Windows

» Unattended??? OMG!!!


ATOzTOA : Latest Headlines


2 comments:

Share tips said...

This information provided by your blog is very helpful l for New Traders in Stock Market. We too have provided Stock Market Education on our website at http://www.intradaytips.com

iMedia designs said...

this is a nice post, and was very helpful for me!

Post a Comment