On Wed, Mar 13, 2002 at 12:59:56PM -0300, Borges, Rodolfo wrote:
> it need to control the transfer rate throttling based on the current time.
> something like:
> 8k/s between 7h and 22h
> 24k/s between 22h and 1h
> unlimited between 1h and 7h
You can do something like this in .lftp/rc:
repeat at 7:00 -- "set limit-rate 8000" &
repeat at 22:00 -- "set limit-rate 24000" &
repeat at 1:00 -- "set limit-rate 0" &
The only problem is to set initial rate limit.
Ugh. I have just found a problem - `at' executes the command immediately if
the time is in the past. I think the attached patch will help it.
--
Alexander. | http://www.yars.free.net/~lav/
Index: SleepJob.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/SleepJob.cc,v
retrieving revision 1.16
diff -u -p -u -r1.16 SleepJob.cc
--- SleepJob.cc 2002/01/04 12:31:30 1.16
+++ SleepJob.cc 2002/03/13 16:30:42
@@ -210,6 +210,9 @@ Job *cmd_at(CmdExec *parent)
if(when==0 || when==(time_t)-1)
return 0;
+ if(when<now)
+ when+=86400;
+
char *cmd=0;
if(cmd_start)
{