Bash script to process mail queue
Hi all (my first post here)!
I look after a few CentOS servers, and since I am not a Linux guru some things get out of hand eventually. One of the things that has been bothering me for quite some time is mail queue. On any average day I see around a hundred messages sitting in the queue, 99.99% of them are spam or bounces (mailbox doesn't exist, mailbox full, etc.) Some of these e-mails are sitting there for as long as few days (don't know if it affects the server, but it annoys the hell out of me). What I am looking for is either a setting or help on a bash script to rid of anything that sits there for longer then 48 hours. So far I have found that sendmail -bp lists all the e-mails in the queue but I don't really know how to parse it using bash. Next part is /var/spool/exim/scan folder. I assume it's a part of the queue, therefore I am making it a part of the question. I see a bunch of files and folders going all the way back to 2007 (which is when the server was built). From the name I guess it's a temp folder for scanning incoming and outgoing e-mails so it has to get cleared once the scanning complete. Since it doesn't happen I would also appreciate a setting or help with a script that clears that out. Since the structure of this folder is pretty weird to me (it goes by numbers and letters of the alphabet in both cases, that in turn contain eml files) I am reluctant to just delete them since I suspect there's a database somewhere that keeps track of these things. If you have an answer to any of these feel free to elaborate as much as possible - I'd rather read again something I already know than miss something I have no clue about. |
Try looking into assassin this should help with your spam issue. You may also want to look into another product like barracuda which can help with spam also.
|
Quote:
My question(s) are mostly about settings and shell scripting, not about spam issues. Thank you for understanding. |
Quote:
However yes you can use a shell script with cron and clean the folder up. I will try to cook something up and post back when I have something that works. Unless some one beats me. |
Ok so I did find a starting point. if you used the command
Code:
find /var/log/mail -atime -2 http://linux.die.net/man/1/find that should get you started. |
All times are GMT -5. The time now is 06:23 PM. |