aMule Forum

English => Feature requests => Topic started by: hannibal218bc on December 06, 2004, 10:49:36 PM

Title: Setting bandwidth limits with cron
Post by: hannibal218bc on December 06, 2004, 10:49:36 PM
Hellas,


I added a post to a german thread on that topic, but it seems to me that the real gurus don't speak german ;-))

Anyways, I'd like to set bandwidth limits based on clock, for example with a cron job. The windows eMule offers an integrated "scheduler" for that kind of tasks.

I realize that amuleweb actually can set bandwidth limits, but there is no command or command line switch to amulecmd, at least not one that I was able to find.

Killing amule, modifing the preferences file and starting the mule up again doesn't seem like the "golden way to go".... :-/


Many thanks for your replies folks,
best regards
 -hannes
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 06, 2004, 11:23:51 PM
ye, Scheduler isn't into aMule yet, allthough it will be after aMule 2.0.0 final.
for a cron script, you can use aMuleCMD (like amuleweb). no need to restart aMule with amulecmd ;)

Greetings!
Title: Re: Setting bandwidth limits with cron
Post by: hannibal218bc on December 07, 2004, 11:27:17 PM
Hellas,

thanks Jacobo for your replay. Unfortunatly does amulecmd's help not list something that sounds like bandwidth limits...  could you please give me a hint?

I tried to locate amulecmd's source code, and also tried strings amulecmd to find out the appropriate command.. but failed :-(


Thank you again,
best regards
-hannes
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 08, 2004, 01:26:10 AM
the source files for amulecmd is src/TextClient.cpp

there is (or at leat there used to be) a function for setting the bandwidth limits. But amulecmd is under quite a heavy development right now (same as amuelweb) so maybe it has been temporarily removed. who knows xD

Greetings!
Title: Re: Setting bandwidth limits with cron
Post by: hannibal218bc on December 08, 2004, 02:27:44 AM
Hi again,


thank you for your help; i found out that there is actually a command "PREFERENCES SETMAXUPLOAD xx" / "PREFERENCES SETMAXDOWNLOAD xx" implemented in the server side of aMule, but not in amulcmd (see ExternalConn.cpp).

I am going to try implementing a perl script to issue those commands... check back tomorrow ;-)


Thanks again,
-hannes
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 08, 2004, 04:19:47 AM
huh? a perl script that does the whole identification process + command sending?
are you a perl guru???

K, report tomorrow ;)
Title: Re: Setting bandwidth limits with cron
Post by: lfroen on December 08, 2004, 10:19:09 AM
amulecmd can't change bandwidth limits. At least now. I'm not sure if code is actually ready on core side - how does it gets tested without client anyway ?
Command to amule thru perl script is arcane thing to do - protocol is binary, which perl don't like very match.
If you really want it - consider implementing CECPackets.cpp as perl module first.

And finally you can use Linux's itself banwidth limiting - look at manual of "tc" command
Title: Re: Setting bandwidth limits with cron
Post by: hannibal218bc on December 08, 2004, 07:08:02 PM
Hellas,


I have the perl script working, but it is an ugly quick hack.  A short sniffing session with tcpdump revealed how the binary protocol works,  and ExternalConn.cpp lists all available commands.

With a little knowledge of C it would be a minor hack to inlude that into amulecmd... perhaps even as command line switches...


Whatever, I have attached my hack to this posting, perhaps someone else finds it useful.


Thanks again for your help, Jacobo!,
greetings
-hannes
Title: Re: Setting bandwidth limits with cron
Post by: GonoszTopi on December 08, 2004, 07:39:51 PM
hannibal218bc, you are using EC protocol version 1.0 in your pl script. This is now obsolete. We're going full binary on EC, to gain some speed/bandwidth/flexibility.

lfroen, code IS implemented in ExternalConn.cpp since webserver IS able to set BW limits.

Jacobo221, amulecmd can not and never could set bw limits.

hannibal218bc, It'd need me 3 mins to implement it, so look at tomorrow's CVS tarball (I hope I won't forget to actually do it :) )
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 08, 2004, 08:28:02 PM
hannibal218bc: don't lie to me: you're real name is Larry Wall... ;-)

congrats for your amazingly fast and well done script. Let's see how good you do with ECv2 ;-D

oh, and no problem. you have my help for anything you might need it :-)

GonoszTopi: I'm almost sure it existed not much time ago ;-)
Title: Re: Setting bandwidth limits with cron
Post by: GonoszTopi on December 08, 2004, 10:43:54 PM
Requested feature added to CVS, check out tomorrow's CVS tarball.
Title: Re: Setting bandwidth limits with cron
Post by: lfroen on December 09, 2004, 05:27:55 AM
Quote
GonoszTopi: I'm almost sure it existed not much time ago ;-)

No, you wrong here.
Title: Re: Setting bandwidth limits with cron
Post by: djtm on December 10, 2004, 03:53:17 PM
you can just use this script

http://gentoo-wiki.com/HOWTO_Apache_2_bandwidth_limiting

and change the port to your aMule port ;)

then change the script so that it accepts a parameter and put it in your cron.

;)

biut it's good to know that it's added to amulecmd now. I think amulecmd could support adding a ed2k link, but I don't wanna bug.
Title: Re: Setting bandwidth limits with cron
Post by: stefanero on December 10, 2004, 04:21:38 PM
for adding ed2k link htere is already a console tool,,,,

why would you want two?

stefanero
Title: Re: Setting bandwidth limits with cron
Post by: djtm on December 10, 2004, 04:34:49 PM
because it works remote. This would mean it could be used to implement a script, that remotely adds ed2k link easily. And I would immediately write that script once that feature would be out ;)
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 10, 2004, 05:43:48 PM
yes. otherwise adding a new download remotely requires an ssh account. I'm for supporting ed2k links in amulecmd too. in fact, webserver does it ;)
Title: Re: Setting bandwidth limits with cron
Post by: Kry on December 10, 2004, 07:02:04 PM
Blindness around?

Quote
aMulecmd$ help

----------------> Help: Available commands (case insensitive): <----------------

Connect [server IP]     Connect to given/random server. No warn if failed!
Disconnect:             Disconnect from server.
Servers:                Show server list.
Stats:                  Shows status and statistics.
Show DL | UL:           Shows Download/Upload queue.
List :         Lists or finds downloads by name or number.
Resume [n | all]:       Resume file number n (or 'all').
Pause [n | all]:        Pauses file number n (or 'all').
SetIPFilter : Turn on/off amule IPFilter.
ReloadIPF:              Reload IPFilter table from file.
IPLevel [level]:        Shows/Sets current IP Filter level.
Add         Adds to aMule.
                                Currently file and server links are supported.

SetUpBWLimit    Sets maximum upload bandwidth.
SetDownBWLimit  Sets maximum downloadload bandwidth.
GetBWLimits             Displays bandwidth limits.
Help:                   Shows this help.
Quit:                   Exits Textclient.
Shutdown:                       Shutdown amule

----------------------------> End of listing <----------------------------------
aMulecmd$              
Title: Re: Setting bandwidth limits with cron
Post by: Jacobo221 on December 10, 2004, 07:24:37 PM
8) uh, chould you write with white font, please? I read wearing sunglasses 8)
:P
Title: Re: Setting bandwidth limits with cron
Post by: djtm on December 10, 2004, 07:28:56 PM
Ah, he prrobabbblee jost deed thad... :D


...darn, now I gotta write that script :P
Title: Re: Setting bandwidth limits with cron
Post by: Kry on December 10, 2004, 07:52:22 PM
Code: [Select]
Revision 1.49 / (view) - annotate - [select for diffs] , Tue Nov 16 14:09:59 2004 UTC (3 weeks, 3 days ago) by gonosztopi
Branch: MAIN
Changes since 1.48: +23 -4 lines
Diff to previous 1.48

Added new command "add " to amulecmd.
Title: Re: Setting bandwidth limits with cron
Post by: djtm on December 10, 2004, 08:08:57 PM
æ?¶?ð???«»¢?? !?!
 :D

"Couldn't you just have say nothing at all...?"
darn, I hate to be proven wrong...