Clean up script for tmp files
mailscanner at barendse.to
Sat Feb 15 09:08:52 GMT 2014
I slightly modified the script, if i remove "-maxdepth 1" from opts the
script completes without errors and i included /tmp.
However, the find command doesn't find the files. Even when i set days to
1, i still find files that are 3-4 days old.
When i do :
find /var/spool/MailScanner/incoming/SpamAssassin-Temp/ -name 'tmp.*'
it finds all the files, when i add "-mtime +1" it doesn't find anything
Clues anyone? Could it be that mtime doesn't work on zero byte files?
On Wed, 12 Feb 2014, Jethro R Binks wrote:
> I've run this nightly for years which may help:
> ## MailScanner, SpamAssassin and so on tend to leave files around, so this
> ## will clean up any more than $days old
> ## v2.1
> # Defined in MailScanner.conf, "Incoming Work Dir":
> # Defined in MailScanner.conf, "SpamAssassin Temporary Dir":
> # Defined in clamd.conf, "TemporaryDirectory":
> opts="-mtime +$days -maxdepth 1"
> find $SATMP -name '.spamassassin*' $opts | xargs rm -rf
> find $SATMP -name 'update_spamassassin*' $opts | xargs rm -rf
> find $MSWORK -name '[0-9]*' -type d $opts | xargs rm -rf
> find $CLAMAVTMP -name 'packlist.*' -type f $opts | xargs rm -rf
> find $CLAMAVTMP -name 'checkholddir.*' -type f $opts | xargs rm -rf
> find $CLAMAVTMP -name 'clamav-*' $opts | xargs rm -rf
> On Wed, 12 Feb 2014, Remco Barendse wrote:
>> I know the subject was discussed on the mailing list several times but i
>> didn't find the ultimate solution.
>> Does anyone have a super duper cleanup script for all the files in :
>> for files like tmp.DPhoj31724
>> for files like .spamassassin3805xUDKuUtmp
>> They are seriously clogging up my filesystem and slowing down the system.
>> I tried to script something based on the age of the file but it didn't
>> work (maybe because most are zero byte files).
>> MailScanner mailing list
>> mailscanner at lists.mailscanner.info
>> Before posting, read http://wiki.mailscanner.info/posting
>> Support MailScanner development - buy the book off the website!
> . . . . . . . . . . . . . . . . . . . . . . . . .
> Jethro R Binks, Network Manager,
> Information Services Directorate, University Of Strathclyde, Glasgow, UK
> The University of Strathclyde is a charitable body, registered in
> Scotland, number SC015263.
More information about the MailScanner