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.

Looking for script that empty spambox folder!

Discussion in 'General Discussion' started by wimp, Feb 6, 2005.

  1. wimp

    wimp Well-Known Member

    Joined:
    Jul 13, 2002
    Messages:
    301
    Likes Received:
    0
    Trophy Points:
    16
    hi all,
    spamassassin is greate. However most customer don never empty there spambox so a lot of space will be used. Is there any script that can empty the spambox afther x days automatically?


    Thanks a lot
     
  2. lostinspace

    lostinspace Well-Known Member

    Joined:
    Jul 19, 2003
    Messages:
    122
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Colorado Springs, CO
    Under the spamassasin options in cpanel you can already do this. However, you must visit each accounts cpanel.

    I run RELEASE build.
     
  3. AndyMurray

    AndyMurray Registered

    Joined:
    Jun 12, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I once made a script which trims the spambox to the last 30 days only. PM me if you want the code as I don't have it to hand.
     
  4. payne

    payne Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Seattle
    If you find it, can you post it here? So we don't all pester you individually.
     
  5. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    697
    Likes Received:
    1
    Trophy Points:
    18
    Yes, thanks!
     
  6. daniele81

    daniele81 Member

    Joined:
    Aug 27, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Empty all spamboxes (very simple solution)

    I empty all spamboxes every 2 hours with this command on crontab:

    This command find all files named "spam" with group "mail" on /usr/home (my homes directory), then truncate it at zero byte.

    The command "truncate" works fine on FreeBSD (i don't know on Linux).
    It's brutal, but works.
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    There's unlikely to be a truncate command on Linux. However, you could simply replace the truncate function with cat /dev/null > filename

    That said, user education is probably better :)
     
  8. beekeeper

    beekeeper Active Member

    Joined:
    Apr 28, 2003
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Melbourne, Australia
    Each to his own and this may well suit your needs but the above approach defeats the purpose of having a spambox.
     
  9. payne

    payne Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Seattle
    I think we'll run this weekly. That way, they have a spam box, but it doesn't get out of hand, especially for those folks who never check it (it is on or off for the entire account).
     
  10. payne

    payne Well-Known Member

    Joined:
    May 31, 2003
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Seattle
    so, I can't get it to work. I'm trying:

    Code:
    find /home -name "spam" -group mail -exec cat /dev/null > {} \;
    and it isn't working. I've tried them separately, the find works and the cat /dev/null works when I replace the {} with a filename... they just don't work together like this. What am I missing?
     
  11. vla

    vla Member

    Joined:
    Jun 19, 2004
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    I use the following on several linux boxes


    $ find /home -name "spam" -group mail -follow | xargs -i -t rm -f {}
     
  12. ispro

    ispro Well-Known Member

    Joined:
    Apr 8, 2004
    Messages:
    628
    Likes Received:
    1
    Trophy Points:
    18
    Use the following code:
    We are using this code and it works well. It remove the SpamBox only if the inbox over 1 Mb.
     
  13. dprophit

    dprophit Member

    Joined:
    Apr 1, 2002
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Useful! Added to cron.weekly

    Thanks guys! I added find /home*/*/mail/ -name "spam" -group mail -size +1024k | xargs -i rm -f {} to the cron
     
  14. bjarte

    bjarte Member

    Joined:
    Dec 8, 2005
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    find /home/*/mail/ -name "spam" -size +1024k | xargs -i sh -c "cat /dev/null > {}"
     
  15. rec9140

    rec9140 Registered

    Joined:
    Jun 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I am trying to add this to a site to test it out, but when I add it to the crontab using standard mode it cuts it off at

    Code:
    find /home/*/mail/
    
    And when I add it via the unix mode, it doesn't even add it to the crontab.

    Any hints?

    cPanel Build 10.9.1-STABLE 14304
    Theme cPanel X v2.6.0
     
Loading...

Share This Page