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.

checkmailquota - script to alert POP/IMAP users near quota

Discussion in 'E-mail Discussions' started by shacker23, Sep 22, 2005.

  1. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    After very nearly losing a key customer who lost a lot of important mail when his POP account went over quota, I've been looking for something that would send email alerts to POP account holders when their mailboxes are near quota, and summaries of accounts near quota to the hostmaster. Didn't find anything that seemed to do the job neatly, so wrote a shell script for cPanel systems, available here:

    http://hosting.birdhouse.org/scripts/checkmailquota.txt

    checkmailquota loops through the home dirs and, for each home, loops through hosted domains. For each domain, loops through mailboxes, recording byte sizes. Compares these sizes to what's listed in the quota file for that mailbox. If usage is within xx% of quota, sends a warning message to that mailbox. At end of script, sends a summary of accounts near quota to postmaster.

    When I switched to cPanel, I did so because I was getting tired of writing stuff like this all the time. cPanel has seemed pretty complete, but it seems bizarre to me that a script like this, or equivalent functionality, isn't built into the system (at version 10 no less!) Weird. Anyway, hope someone finds this useful.

    If you make modifications or have suggestions, please send them on.
     
  2. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    This script has been revved to v 1.2, and now works on cPanel systems with boxtrapper installed. Also now handles cases where users have deleted their quota files.
     
  3. Damian

    Damian Well-Known Member

    Joined:
    Oct 1, 2001
    Messages:
    95
    Likes Received:
    1
    Trophy Points:
    8
    There is a script that's included with cPanel.

    Under tweak settings look for:

    Notifications

    * Disable Suspending accounts that exceed their bandwidth limit (will clear all suspensions is disabled)
    * Disk Space Usage Warnings
    * Email Box Usage Warnings

    The wording from this email is ordinary at best but it's functional. The message comes from a host based email address so it may not be suitable to run if you offer reseller based hosting. From memory this script runs at the 80% mark.
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Indeed, but it it only run once per day as part of the nightly upcp run.
     
  5. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    Odd - I have that enabled, have always had it enabled. But neither I nor my customers have ever received autogenerated email quota notifications. So it works on your cPanel systems?

    Well, I like the configurability of my script:

    - Ability to alter the message text
    - Ability to modify layout of the summary message
    - Ability to turn/off notifications to POP owners or hostmaster separately
    - Ability to customize the checking schedule via crontab
     
  6. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    v 1.3 adds a mailbox count as an FYI, so you know roughly how many mailboxes are handled by your server.
     
  7. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    697
    Likes Received:
    1
    Trophy Points:
    18
    Be sure to add this as a "bug" to the bugzilla.cpanel.net system. Let them know that you have developed it and wish the code to be added into the cpanel system...

    Eventually (2 years from now?) they might add this functionality.. (or add it to what crappy functionality already exists.)

    Be sure to post the bugzilla number here so we can vote for it.

    :)
     
  8. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
    Thank You!

    Thank you very much for sharing your most useful script with us. Seems logical that cPanel should include something like this and will get my vote if you do as electric suggests.
    Thanks again.
     
  9. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    v 1.4 only sends warning messages to users if mail quota usage is over specified threshold but also under 100% -- no point in sending to over-quota accounts since user won't receive them, and the bounces will just be returned to root anyway.

    Glad to hear people are finding this useful, thanks.

    If you want to vote on it, this is bug #3306 in bugzilla:
    http://bugzilla.cpanel.net/show_bug.cgi?id=3306
     
    #9 shacker23, Oct 1, 2005
    Last edited: Oct 2, 2005
  10. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
    I Just Voted

    Well done. I hope lots of people spend the few seconds it takes to add their vote for this great time saving improvement.
    Thanks again. :)
     
  11. spaceman

    spaceman Well-Known Member

    Joined:
    Mar 25, 2002
    Messages:
    481
    Likes Received:
    0
    Trophy Points:
    16
    Just got my vote. I MASSIVELY agree with your comment "For many of us, over-quota mailboxes continue to be one of the leading support issues."

    I only just heard about your script over here: http://forums.cpanel.net/showthread.php?t=43698 and have added some additional comments on what a complimentary script might look like.
     
  12. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Just added my thoughts to the entry about using the inbuilt exim commands to achieve a similar solution.
     
Loading...

Share This Page