Version 2 (modified by Waldorf, 12 years ago) (diff) |
---|
Bandwidth Scheduler Script
Notes
Add this script to cron to make it work.
Script
#!/bin/bash # The script will limit speed settings between # the following hours. Note: only use whole # hours, minutes are not supported! start_time=10 end_time=22 # Normal speed setting: normal_speed="-D -U" # Speed limit setting: limited_speed="-d100 -u20" # Authentication "username:password": #tr_auth="admin:admin" # Transmission host: tr_host="127.0.0.1:9091" # Verbose? verbose=1 ############################################# time=$(date +%H) if [ $tr_auth ]; then tr_auth="--auth=$tr_auth" fi if [[ $time -ge 1 ] -a [ $time -lt 10 ]]; then /usr/local/bin/transmission-remote "$tr_host $tr_auth $limited_speed" > /dev/null if [ $verbose ]; then date "+%Y-%m-%d (%H:%M:%S) Transmission speed limit changed"; fi else /usr/local/bin/transmission-remote "$tr_host $tr_auth $normal_speed" > /dev/null if [ $verbose ]; then date "+%Y-%m-%d (%H:%M:%S) Transmission speed limit changed"; fi fi exit 0