Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 17th August 2012, 18:00
EckyBrazz EckyBrazz is offline
Member
 
Join Date: Jul 2012
Location: Goinia, Brazil
Posts: 37
Thanks: 3
Thanked 4 Times in 1 Post
Default Script to clean up old Trash, Junk and Spam mail.

Hi Folks,

Just found a script that I have adjusted to work with ISPConfig 3 to clean up the old trash mail ect.

Code:
 #!/bin/bash
MAILDIRS=$(find /var/vmail/*/*/Maildir/ -maxdepth 0 -type d)
for basedir in $MAILDIRS; do
  for dir in .Trash .Junk .Spam .Low\ Priority; do
    for dir2 in cur new; do
      [ -e "$basedir/$dir/$dir2" ] && (
        echo "Processing $basedir/$dir/$dir2..."
        find "$basedir/$dir/$dir2/" -type f -mtime +30 -delete
      )
    done
  done
done
When migration from Cpanel to ISPconfig I found that my users have a lot of old mails in the trash. When I ran this script it saved me about 25GB of diskspace.
__________________
Michael Burgos
www.vecks.com.br
Reply With Quote
The Following 4 Users Say Thank You to EckyBrazz For This Useful Post:
falko (18th August 2012), florix.net (21st March 2013), technoid (24th March 2013), till (18th August 2012)
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Move Spam Emails to Junk directory by default? Spamfilter = Normal by default? radim_h Tips/Tricks/Mods 4 17th January 2012 23:25
Junk mail folder Rescue9 General 2 23rd March 2010 14:00
imapd: Error reading ACLs for INBOX..Junk: Invalid argument playalistic Installation/Configuration 6 2nd December 2009 11:42
Move junk mail to a folder instead of deleting grant Tips/Tricks/Mods 20 22nd October 2008 23:09
Junk mail and spamassassin... sthompson Installation/Configuration 4 27th December 2006 16:11


All times are GMT +2. The time now is 23:49.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.