Page 1 of 1

Clean up quarantined mails

Posted: Sun Jun 15, 2008 7:36 am
by breun
I noticed the /var/spool/qscan/quarantine folders on our servers were growing pretty fast and then learned that quarantined files are not cleaned up automatically. Would it be a good idea to add a cronjob like /etc/cron.daily/qmail-scanner-quarantine-cleanup with the following to the qmail-scanner package?

Code: Select all

#!/bin/sh
#
# Remove all files quarantined by qmail-scanner that were created more than 7 days ago

/usr/bin/find /var/spool/qscan/quarantine -type f -ctime +7 -exec rm -f {} \;
Or maybe even make the cleanup time configurable in /etc/qmail-scanner.ini?

Posted: Sun Jun 15, 2008 9:11 am
by scott
Sure, maybe disable by default or something

Posted: Mon Jun 16, 2008 4:24 pm
by breun
Do you plan on adding this to the qmail-scanner package or should I start deploying this cronjob myself?

Posted: Tue Jun 17, 2008 8:41 am
by scott
Yeah thats what I was thinking of adding it to. It already has a contrib dir for things like that. I'd add it in now, I'm not sure how soon we'll be able to get an update out. I've still got to clean up the mysql back end for ASL to get it out by the 23rd.

Posted: Fri Jun 20, 2008 4:16 pm
by jwdick
I have Art's qmail-scanner, spamassassin and clamav installed. In my /etc/logrotate.d folder there is a file named "qmail-scanner". It contains the following:

/var/spool/qscan/qmail-queue.log {
#Shove this in as /etc/logrotate.d/qmail-scanner
missingok
create 0600 qscand qscand
daily
rotate 1
postrotate
/var/qmail/bin/qmail-scanner-queue.pl -z
/usr/bin/find /var/spool/qscan/quarantine -type f -mtime +7 -exec /bin/rm -rf {} \;
endscript
}

This keeps my qmail-queue log rotated daily and removes the quarantined files over 7 days old whick keeps the folders relatively small.

I would guess this file was installed when qmail-scanner was installed because I know that I did not install myself. Could this be what you are asking for breun?

Posted: Sat Jun 21, 2008 7:05 am
by breun
Good find. But apparently the default is 30 days instead of your 7. This is what /etc/logrotate.d/qmail-scanner looks like on our machines:

Code: Select all

/var/spool/qscan/qmail-queue.log {
        #Shove this in as /etc/logrotate.d/qmail-scanner
        missingok
        create 0600 qscand qscand
        daily
        rotate 1
        postrotate
                /var/qmail/bin/qmail-scanner-queue.pl -z
                /usr/bin/find /var/spool/qscan/quarantine -type f -mtime +30 -exec /bin/rm -rf {} \;
        endscript
}

Posted: Sat Jun 21, 2008 8:57 am
by jwdick
That is correct. The default was 30 when I first found this script. When I read your original post ( just like when I read all revelant posts ), I checked on my servers for what you were talking about. The folders were large but not overwhelmed so I knew "something" was cleaning them. Then I found this script, I wasn't for sure it the script keeping the folders clean, so I changed the clean up time to make sure it was working BEFORE I posted my comment. Just my way of making sure I do not post misleading or inaccurate comments.

Posted: Sat Jun 21, 2008 10:09 am
by scott
Ha! I must have done that years ago. Go me.