Lubos Rendek

The only solution is determination.

Simple Way to Schedule Torrent Download

| Comments

There are times that you want to schedule your torrent or any other download for a particular time. There maybe a number of reasons to do so and one of them maybe a peak and off peak download limitations enforced by your internet provider. If your application does not have a scheduled timer for download you can simply use iptables to block all the traffic and re-enable it at any given time with at command. Here is an example of scheduling download ( enabling network traffic ) at 2AM while your torrent client remains started at all times.

First block your network traffic with:

1
2
# iptables -P INPUT DROP
# iptables -P OUTPUT DROP

At this point you will notice that your network traffic whether incoming or outgoing is down. Next, create a iptables restore file:

1
2
3
4
5
6
7
cat restore-network
# Generated by iptables-save v1.4.14 on Tue Apr 22 19:21:25 2014
*filter
:INPUT ACCEPT [303:50630]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3780:635312]
COMMIT

Create a at command text file with a commands you which to execute. In our case the file will contain only a single line:

1
2
# cat restore_traffic
/sbin/iptables-restore /root/restore-network

Once ready execute at command and include your commands list file:

1
2
3
# at 2AM < restore_traffic
warning: commands will be executed using /bin/sh
job 9 at Wed Apr 23 02:00:00 2014

Please note that you need to run at command as privileged root user. It is also possible to include command directly to at command.

Comments