Bandwidth Controller Script for Tor by Bogdan Drozdowski
Some server operators wish to have a tool which would change their Tor server's bandwidth limit at given times. The simplest solution I could come with is the following Perl script: torbandwctl.pl.
Syntax: perl torbandwctl.pl [-p|--port NNNN] hour1:min1 "bandwidth1" [hour2:min2 "bandwidth2" ...] &
- NNNN is the Tor control port number (default: 9051)
- hour1:min1 is the time at which the script should set the Tor bandwidth to bandwidth1
- bandwidth1 is the bandwidth value, in any format Tor can understand. It should be put in quotes, because running the script as
torbandwctl.pl hh:mm 1 MB
will cause the "1 MB" part to be passed as two separate arguments.
- The & causes the script to be put in background by the shell (works under Bash). This is required (unless you can afford losing a terminal), because the script never exits.
Example: ./torctl.pl --port 9051 11:37 "500" 11:38 "200"
- Perl's IO::Socket::INET
See also: TheOnionRouter/CronBandwidthLimit