aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: Setting bandwidth limits with cron  (Read 8235 times)

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Setting bandwidth limits with cron
« 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
Logged

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Setting bandwidth limits with cron
« Reply #1 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!
Logged

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: Setting bandwidth limits with cron
« Reply #2 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
Logged

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Setting bandwidth limits with cron
« Reply #3 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!
Logged

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: Setting bandwidth limits with cron
« Reply #4 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
Logged

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Setting bandwidth limits with cron
« Reply #5 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 ;)
Logged

lfroen

  • Guest
Re: Setting bandwidth limits with cron
« Reply #6 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
Logged

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: Setting bandwidth limits with cron
« Reply #7 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
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Setting bandwidth limits with cron
« Reply #8 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 :) )
Logged
concordia cum veritate

Jacobo221

  • Hero Member
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 2712
Re: Setting bandwidth limits with cron
« Reply #9 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 ;-)
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Setting bandwidth limits with cron
« Reply #10 on: December 08, 2004, 10:43:54 PM »

Requested feature added to CVS, check out tomorrow's CVS tarball.
Logged
concordia cum veritate

lfroen

  • Guest
Re: Setting bandwidth limits with cron
« Reply #11 on: December 09, 2004, 05:27:55 AM »

Quote
GonoszTopi: I'm almost sure it existed not much time ago ;-)

No, you wrong here.
Logged

djtm

  • Jr. Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 95
Re: Setting bandwidth limits with cron
« Reply #12 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.
Logged
"If you laid all of our laws end to end, there would be no end."
Mark Twain
"Linux is like a wigwam: No Gates, no Windows, but Apache inside!"

stefanero

  • Some Support
  • Developer
  • Hero Member
  • *****
  • Karma: 8
  • Offline Offline
  • Posts: 4235
Re: Setting bandwidth limits with cron
« Reply #13 on: December 10, 2004, 04:21:38 PM »

for adding ed2k link htere is already a console tool,,,,

why would you want two?

stefanero
Logged
In its default setup, Windows XP on the Internet amounts to a car
parked in a bad part of town, with the doors unlocked, the key in
the ignition and a Post-It note on the dashboard saying, "Please
don't steal this."

djtm

  • Jr. Member
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 95
Re: Setting bandwidth limits with cron
« Reply #14 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 ;)
Logged
"If you laid all of our laws end to end, there would be no end."
Mark Twain
"Linux is like a wigwam: No Gates, no Windows, but Apache inside!"
Pages: [1] 2