|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello,
I remember there used to be an Email Aging option in cPanel that is no longer available. I'm looking for something similar that I can apply to all accounts. Basically, I would like to be able to delete all emails on the server that are older than 2 years. Any scripts or way of doing this ? Thank you. |
|
|||
|
Quote:
for mail that is older than two years: Code:
find -P /home/*/mail/*/*/cur -mtime '+729' find -P /home/*/mail/*/*/new -mtime '+729' and you can either pipe that into 'xargs' for a very quick and dirty way of doing that pipe into a file and then have a script parse the file to do whatever you would like. Here is a very basic example: Code:
#!/bin/bash
IFS="$"
cd /home
find -P /home/*/mail/*/*/* -mindepth 1 -maxdepth 1 -mtime '+729' | while read OLDMAIL; do
echo "Now deleting ${OLDMAIL} ..."
rm -f "${OLDMAIL}"
done
You could delete the "echo" line and add this basic code to a cronjob and have your server auto delete all mail older than 2 years or whatever length of time that you want.
__________________
[b][color="Blue"]Server Support[/color]: [color="Red"]Server consulting, security, and management![/color][/b] Last edited by Spiral; 06-14-2009 at 12:46 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to delete all mails on server older than X years.. | ramystyle | cPanel and WHM Discussions | 1 | 04-07-2008 03:29 AM |
| Forward emails and auto delete from inbox. | lazydayz | 4 | 12-18-2007 02:07 PM | |
| how to auto reject and delete emails like this? | roby2k | cPanel and WHM Discussions | 5 | 02-07-2007 08:59 AM |
| Spamassassin Auto Delete Spam Emails | cheemin | cPanel and WHM Discussions | 3 | 09-01-2006 12:15 AM |
| Delete emails from spam box older than x days | Netmaking | cPanel and WHM Discussions | 4 | 12-02-2004 09:05 AM |