The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bandwidth Accessible by PERL?

Discussion in 'General Discussion' started by isoprax, Mar 13, 2004.

  1. isoprax

    isoprax Registered

    Joined:
    Mar 13, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Hamilton, Ontario
    Well I've done some hunting around and all I've seen so far is one other person who wanted to know the same thing as I but he wasn't answered. I hope I have more luck.


    In short. I have audio available on my site. I have 20 gigs per month of bandwidth. I would like to write a PERL script that is able to read my current bandwidth total and act accordingly.

    Example: Site visitor clicks on audio link. htaccess directs the request first to the PERL script. The PERL script checks to see if the bandidth is near the limit for the month. IF it is then it redirects the visitor to a page explaining what's what. If it isn't near the bandwidth limit then it allows the visitor to download the file.

    clear? I think so. the only part I can't do so far is check the bandwidth with a script. Is this possible? Am I dreaming in my quest to automate this? In short, does madness lie this way?
     
  2. ddeans

    ddeans Well-Known Member

    Joined:
    Feb 13, 2004
    Messages:
    296
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Maryland
    I have a script that will allow you to evenly distribute the bandwidth. for example, give whoever click's on it a 20% chance to download the file for the day. And you can set the amount of bandwidth to use per day. Is that something you are intrested in?
     
  3. isoprax

    isoprax Registered

    Joined:
    Mar 13, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Hamilton, Ontario
    i don't think so. What I need is my PERL script to be able to read how much Bandwidth has been used already. So it can either cut the download off politely or let it proceed.
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    The file you want to read is at:
    /var/cpanel/bandwidth/[domain.com]

    Here's a sample of how it records it:
    11.24.2003-all=393040674
    11.24.2003-ftp=133129137
    11.24.2003-http=259911537
     
  5. isoprax

    isoprax Registered

    Joined:
    Mar 13, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Hamilton, Ontario
    Cheers...that's what I was looking for!
     
Loading...

Share This Page