Ticket #2073 (new enhancement)

Opened 7 months ago

Last modified 5 months ago

feature request: set ratios dependent on time of day

Reported by: anonymous Owned by: rakshasa
Priority: low Milestone:
Component: rtorrent Version:
Severity: trivial Keywords:
Cc:

Description

I wonder if it was hard to implement a new configuration option to set e.g. the upload ratio dependent on time of day. E.g. "off" from 00:00 to 10:00 and "60KB" from 10:00 to 00:00.

Attachments

Change History

Changed 6 months ago by rot

This can be done externally via script in crontab.

Here is an example:

#!/usr/bin/perl
use RTPG
use warnings
use strict;
my $rt = RTPG->new(url => '/home/rtorrent/scgi');
my ($u,$d) = (1024*$ARGV[0],1024*$ARGV[1]);						     	$rt->rpc_command('set_upload_rate',$u);						$rt->rpc_command('set_download_rate',$d);

To set upload speed to 25kB/sec and download speed to 75kB/sec, you will run this as follows:

./setspeed.pl 25 75

Run the script in crontab at the time you want.

Note: Install RPC::XML and RTPG modules from your repository or CPAN.

Changed 6 months ago by anonymous

You don't need a script, rtorrent has a built-in schedule feature to run commands at a certain time-of-day.

Try

schedule=up_off,0:00:00,24:00:00,upload_rate=0
schedule=up_limit,10:00:00,24:00:00,upload_rate=60

Note that the second time argument is an interval, not the stop time. So to run something always at the same time-of-day it has to be 24:00:00. (Might break on daylight saving changes though.)

Changed 5 months ago by anonymous

Neither the cron job or built-in scheduling addresses the feature request (as I read it). It is the difference between edge-triggered scheduling and level-triggered scheduling.

Edge-triggered scheduling is what the cron job and built-in scheduling do. That is, the action takes place at the event time only and the event is defined only in terms of the start time of the event.

Level-triggered scheduling is defined as a time range. If the time is within that range then the given settings apply.

Level-triggered is useful when you start rtorrent. At the moment the scheduling does not change the settings until the next trigger so the settings may be wrong between the rtorrent start time through to time the next trigger occurs. E.g. If the default upload rate is 60kB/s and you start rtorrent at 02:00, the upload rate will stay as 60kB/s, whereas it should be 0kB/s until 10:00 given the rules in this feature request.

Changed 5 months ago by anonymous

Then you add a command to .rtorrent.rc to run a little shell script to check the current time-of-day and set the initial upload rate appropriately based on the exit code.

It's not pretty either, but it works.

Add/Change #2073 (feature request: set ratios dependent on time of day)

Author


E-mail address and user name can be saved in the Preferences.


Action
as new
 
Note: See TracTickets for help on using tickets.