I have knocked up a couple of scripts to throttle up and throttle down the speed based on your suggestion.
bt-throttle-down.sh
- Code: Select all
#! /bin/sh
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?auto_bandwidth_management="0"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_dl_rate="1024"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_ul_rate="1024"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_ul_rate_seed="1024"
bt-throttle-up.sh
- Code: Select all
#! /bin/sh
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?auto_bandwidth_management="1"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_dl_rate="-1"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_ul_rate="-1"
wget -q -t 1 -O /dev/null http://localhost:8080/api/app-settings-set?max_ul_rate_seed="-1"
Crontab
- Code: Select all
# Throttle the bittorrent manager according to time of day
# Throttle down at 3:45pm, 15 minutes before ISP's peak usage period
43 15 * * * /usr/share/bittorrent/bt-throttle-down.sh
# Throttle up at a quarter past midnight, 15 minutes after ISP's peak usage period
15 00 * * * /usr/share/bittorrent/bt-throttle-up.sh
Notes:
Here's a few things I discovered in doing this.
1) The bandwidth parameters to the web api are actually specified in Bytes, unlike the UI which uses KBytes. I could therefore have set limits lower than 1KB/s but the UI complains when ever you go into the settings screen
2) I could only specify 1 setting at a time, so that's why I make 4 calls to app-settings-set
3) It's takes a while torrents to completely throttle down so I give them 15 minutes
I hope this is useful to others.
