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.

edit action after quota exceeded

Discussion in 'General Discussion' started by menatwork, Feb 9, 2007.

  1. menatwork

    menatwork Registered

    Joined:
    Jul 3, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    On my server there are users who update their own site and upload files on it. However when the quota exceeds the server will stop receiving email for that domain. I would like that the system only sends a mail to me so i can adjust the quota and bill the user for it. Now i get angry people because their important email doesn't come in anymore.

    Is there a way to change Cpanels action on disk quota exceeding?

    Kind regards Martin
     
  2. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    which quota are you talking about? the email quota or the account quota?
     
  3. menatwork

    menatwork Registered

    Joined:
    Jul 3, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    it seems the same? When i have an account of 50mb it will be used for email, webspace, database......

    One way or the other i always want the email to continue and not to be stopped. I'll bill or upgrade the clients package after exceeding their quota.
     
  4. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    actually the quotas are not the same. you or your customer could have the email quota set at 10mb, and the account at the 50 that you allot. anytime it exceeds 10, the emails would bounce back to the sender, stating that the mailbox is full.

    anyway, as to what you want to do, there is a script out there that allows to do this, I just can't remember where I saw it. otherwise, you could also modify some of the cpanel files responsible for quota checking and emailing the notice. if you change those, they may be overwritten by your next update.

    The file you want to check out is /scripts/quotacheck.
    you could theoretically change the email warnings it sends out. see functions dispatchmessagetoadmin and dispatchdisk at the very bottom. Maybe you could even add a hook or a new routine to increase the quota automatically, and send you and/or the user a notification that it was increased.

    Whatever you do, if you make changes, you may want to chattr +i /scripts/quotacheck to set the file to "immutable"
     
  5. menatwork

    menatwork Registered

    Joined:
    Jul 3, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thanks, great answer, i found the function that emails the warnings but i can't see how i should adjust this so that the mail keeps coming in, even when it's over the quota.

    You said something about adding a hook that would upgrade the quota, how does that work?
     
  6. ujr

    ujr Well-Known Member

    Joined:
    Mar 19, 2004
    Messages:
    290
    Likes Received:
    0
    Trophy Points:
    16
    Wel, you mentioned that you, not your user should receive the emails, so just change the dispatchdisk to email to the admin, for instance.

    As far as creating a hook so that you can automatically increment the quota allotment, you will need to write a script for that and modify the basic functionality of the quota checking script.

    In other words, instead of simply sending an email, make it make a call to the editquota script, found in /scripts/editquota

    editquota takes (expects) two variables: "user" and "quota"

    quotas are already queried in the quotacheck script, so it's easy enough to modify it....

    currently quotacheck checks for account less than 90% used, over 90% used (send warning) and over 98% used (send critical warning). The user will get a message when they reach 90% usually, so if you wanted to increase the quota at that level, you would modify that condition, and call your routine to increase the quota, then send an email to you that it was done, and to the user if you'd like.

    Really, it's up to your imagination what you want to do.

    You will need some solid perl skills to do this.
     
  7. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    481
    Likes Received:
    0
    Trophy Points:
    16
    This would be a very useful reporting tool indeed to have in WHM. A daily email report to a single nominated email address listing all hosting accounts close to or at their storage (and/or bandwidth) account limit.

    This would give us, the hosting provider, an opportunity to either

    a) Give great proactive support in helping the account holder to reduce their usage

    or

    b) Upsell the account holder to a more generous hosting account.

    It's just the sort of thing some bright spark might write as a WHM Add-on (as opposed to waiting for the cPanel people to get onto it). Hint, hint. ;)
     
  8. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    Tweak Settings >> "Disk Space Usage Warnings" and "Mail Box Usage Warnings"

    Isn't it what you're looking for ?
     
Loading...

Share This Page