Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 15 of 15
  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    303

    Exclamation Looking for script that empty spambox folder!

    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. #2
    Member lostinspace's Avatar
    Join Date
    Jul 2003
    Location
    Colorado Springs, CO
    Posts
    124

    Default

    Under the spamassasin options in cpanel you can already do this. However, you must visit each accounts cpanel.

    I run RELEASE build.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    4

    Default

    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. #4
    Member
    Join Date
    May 2003
    Location
    Seattle
    Posts
    103

    Default

    If you find it, can you post it here? So we don't all pester you individually.

  5. #5
    Member
    Join Date
    Nov 2001
    Posts
    455

    Default

    Quote Originally Posted by payne
    If you find it, can you post it here? So we don't all pester you individually.
    Yes, thanks!

  6. #6
    Member
    Join Date
    Aug 2003
    Posts
    19

    Default Empty all spamboxes (very simple solution)

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

    find /usr/home -name "spam" -group mail -exec truncate -s 0 {} \;
    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. #7
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  8. #8
    Member
    Join Date
    Apr 2003
    Location
    Melbourne, Australia
    Posts
    44

    Default

    Quote Originally Posted by daniele81
    I empty all spamboxes every 2 hours with .......
    Each to his own and this may well suit your needs but the above approach defeats the purpose of having a spambox.
    Pass me an Axe!

  9. #9
    Member
    Join Date
    May 2003
    Location
    Seattle
    Posts
    103

    Default

    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. #10
    Member
    Join Date
    May 2003
    Location
    Seattle
    Posts
    103

    Default

    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. #11
    vla
    vla is offline
    Member
    Join Date
    Jun 2004
    Posts
    17

    Default

    I use the following on several linux boxes


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

  12. #12
    Member This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Apr 2004
    Posts
    620

    Default

    Use the following code:
    find /home*/*/mail/ -name "spam" -group mail -size +1024k | xargs -i rm -f {}
    We are using this code and it works well. It remove the SpamBox only if the inbox over 1 Mb.
    Reliable web-hosting, good resellers plans, web-design.
    ISProHosting.com

  13. #13
    Member dprophit's Avatar
    Join Date
    Apr 2002
    Posts
    15

    Talking 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
    ===========================================
    And now for something totally different! -Monty Python

  14. #14
    Member
    Join Date
    Dec 2005
    Posts
    17

    Default

    find /home/*/mail/ -name "spam" -size +1024k | xargs -i sh -c "cat /dev/null > {}"

  15. #15
    Registered User
    Join Date
    Jun 2007
    Posts
    3

    Default

    Quote Originally Posted by bjarte View Post
    find /home/*/mail/ -name "spam" -size +1024k | xargs -i sh -c "cat /dev/null > {}"
    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

Similar Threads & Tags
Similar threads

  1. /scripts folder empty
    By yemgi in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 11-19-2008, 08:02 AM
  2. Help! Mail folder empty... it seems...
    By cecilchen in forum New User Questions
    Replies: 0
    Last Post: 11-12-2008, 09:20 AM
  3. Spambox issue with spam folder hidden or not created
    By webstyler in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-14-2008, 06:18 PM
  4. Accessing SpamBox folder in SquirrelMail
    By pointsi in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 09-05-2004, 01:04 PM
  5. SpamBox activates but doesnt create folder
    By Snowman30 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-10-2004, 07:02 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube