Clean up quarantined mails

Forum for getting help with Project Gamera, Spamassassin, Clamav, qmail-scanner and other anti-spam tools.
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Clean up quarantined mails

Unread post 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?
Lemonbit Internet Dedicated Server Management
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Unread post by scott »

Sure, maybe disable by default or something
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Unread post by breun »

Do you plan on adding this to the qmail-scanner package or should I start deploying this cronjob myself?
Lemonbit Internet Dedicated Server Management
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Unread post 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.
jwdick
Forum User
Forum User
Posts: 55
Joined: Mon Jul 31, 2006 10:55 pm

Unread post 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?
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Unread post 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
}
Lemonbit Internet Dedicated Server Management
jwdick
Forum User
Forum User
Posts: 55
Joined: Mon Jul 31, 2006 10:55 pm

Unread post 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.
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Unread post by scott »

Ha! I must have done that years ago. Go me.
Post Reply