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.

HOWTO: Cleanup the Exim database of junk messages

Discussion in 'General Discussion' started by sexy_guy, Apr 1, 2003.

  1. sexy_guy

    sexy_guy Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    848
    Likes Received:
    0
    Trophy Points:
    16
    There is no mention of cleaning up the Exim db on a daily basis anywhere so most of you, like it did, have lots and lots of junk e-mail messages sitting around in your Exim db that cannot be delivered and sitting there doing nothing. The end result is a bunch of messages in the your exim_mainlog showing as RETRY, UNDELIVERABLE, SMTP TIMEOUT etc. But you can cleanup that junk by following the instructions below;

    First you should execute the following commands from your command line as root before you add the cron entry. This cleans up your db now.

    Copy and paste these commands, one line at a time then press enter. Watch the junk dissappear. You will see loads of junk being deleted. A good thing!

    /usr/sbin/exim_tidydb -t 1d /var/spool/exim retry
    /usr/sbin/exim_tidydb -t 1d /var/spool/exim reject
    /usr/sbin/exim_tidydb -t 1d /var/spool/exim wait-remote_smtp

    After you have cleaned up your db place these commands in a cron that runs at say 5:30am everyday. Thats a good time to do it since email usage is probably at the lowest. Find out what time email usage is at the lowest on your server and change it from 5:30am to whatever time you want. Execute once per day is fine.

    The following cron entry removes all junk msgs if they are more than 1day old.

    pico /etc/crontab and add these entries;

    # Clean up the Exim retry database at the quietest time of day.
    25 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim retry
    30 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim reject
    35 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim wait-remote_smtp

    If you are running MailScanner place these entries in your crontab instead. Do not add these entries if you are not using MailScanner.

    # Clean up the Exim retry database at the quietest time of day.
    25 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim_incoming retry
    30 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim_incoming reject
    35 5 * * * root /usr/sbin/exim_tidydb -t 1d /var/spool/exim_incoming wait-remote_smtp

    Report back with how much junk was deleted :)

    Thats it!


    :D
     
    #1 sexy_guy, Apr 1, 2003
    Last edited: Apr 5, 2003
  2. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA
    wow!!! great tip. I deleted about 500 each try!!!
     
    #2 rpmws, Apr 1, 2003
    Last edited: Apr 2, 2003
  3. xnull

    xnull Well-Known Member

    Joined:
    Sep 9, 2001
    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    16
    I don't know how to find out exactly how much space was restored after running those, but the first command deleted a huge list and the other 2 a decent list of messages as well. Looks good.
     
  4. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Nice tip, thanks for sharing.

    Got rid of about 500 msgs. and the last command deleted about 300 alone!
     
  5. sexy_guy

    sexy_guy Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    848
    Likes Received:
    0
    Trophy Points:
    16
    Go ahead, glad everyone removed so much junk!
     
  6. fuzzie

    fuzzie Well-Known Member

    Joined:
    Oct 12, 2002
    Messages:
    131
    Likes Received:
    0
    Trophy Points:
    16
    Wow, This was an incredible tip!

    Keep 'em coming!
     
  7. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    When you say "MailScanner", does that mean Exim with Virusscan? Sorry, but I'm just starting out, and I don't want to mess anything up.
     
  8. sexy_guy

    sexy_guy Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    848
    Likes Received:
    0
    Trophy Points:
    16
    Re: Re: HOWTO: Cleanup the Exim database of junk messages

    Nope i mean Exim+MailScanner which is a million times better.

    http://www.sng.ecs.soton.ac.uk/mailscanner/
     
  9. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    Glad I asked...:)
     
  10. fuzzie

    fuzzie Well-Known Member

    Joined:
    Oct 12, 2002
    Messages:
    131
    Likes Received:
    0
    Trophy Points:
    16
    Speaking of MailScanner, anyone know of a good tutorial on how to set this up?
     
  11. sexy_guy

    sexy_guy Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    848
    Likes Received:
    0
    Trophy Points:
    16
    OOPS a bug in my cron settings. Review the origional msg for the correction. I left out the user, S/B Root! So it was probably not executing nightly!
     
  12. sexy_guy

    sexy_guy Well-Known Member

    Joined:
    Mar 19, 2003
    Messages:
    848
    Likes Received:
    0
    Trophy Points:
    16
    ;)
     
Loading...
Similar Threads - HOWTO Cleanup Exim
  1. lbh
    Replies:
    4
    Views:
    123
  2. mickalo
    Replies:
    3
    Views:
    171

Share This Page