Tuesday 16 March 2010

Limit Deluge based on time of day, command arguments or a toggle button

I live with my girlfriend and share the apartment with two others, so I can't use all of the bandwidth all of the time. I also work from home, and like to limit my torrent sharing if I'm doing something that requires more bandwidth, so I made this script.

It runs at startup and at 7.10pm on week days. If my computer is turned on in the evening, it limits the bandwidth deluge uses so others in the apartment can do what they like without me clogging things up. This works better than a normal cron job would since I may not have my computer turned on when the cron job is scheduled to run.

I also run this command via a menu entry, with the argument 'toggle', so i can cycle through the three bandwidth settings when i need to.



For deluge versions >= 1.2.0, the script is available here. For pre 1.2.0, the script is available here. See update post for details.

Change the config values at the top of the script to ones that are suitable for you. The script sends a notification via send-notify, and also logs actions to /var/log/messages.


Because it also accepts the arguments 'limit', 'partial' and 'unlimit', it can also be run from the command line, perhaps via ssh if you run deluge on your server or if you want to create buttons for every setting, rather than rely on the 'toggle' functionality.

No comments:

Post a Comment