<p dir="ltr">find -delete may not be present in all platforms. It may be replaced with find -exec rm \{}; IIRC</p>
<div class="gmail_quote">On Feb 19, 2014 9:39 AM, "Kevin Kobb" <<a href="mailto:kkobb@skylinecorp.com">kkobb@skylinecorp.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
It would probably be more efficient to use the find "-delete" action<br>
rather than "xargs rm -rf", but either should work.<br>
<br>
On a side note, does anybody have plans to carve out an "old style"<br>
MailScanner tarball with the fixes from GitHub? i.e. a new 4.8xx release?<br>
<br>
Thanks<br>
<br>
On 2/15/2014 7:17 AM, Jethro R Binks wrote:<br>
> My script was written for FreeBSD. If you're using a different operating system, you'll need to read the manual page for your 'find' command and modify it accordingly.<br>
><br>
>> On 15 Feb 2014, at 09:08, Remco Barendse <<a href="mailto:mailscanner@barendse.to">mailscanner@barendse.to</a>> wrote:<br>
>><br>
>> I slightly modified the script, if i remove "-maxdepth 1" from opts the<br>
>> script completes without errors and i included /tmp.<br>
>> However, the find command doesn't find the files. Even when i set days to<br>
>> 1, i still find files that are 3-4 days old.<br>
>><br>
>> When i do :<br>
>> find /var/spool/MailScanner/incoming/SpamAssassin-Temp/ -name 'tmp.*'<br>
>> it finds all the files, when i add "-mtime +1" it doesn't find anything<br>
>> anymore.<br>
>><br>
>> Clues anyone? Could it be that mtime doesn't work on zero byte files?<br>
>><br>
>> Thanks!<br>
>><br>
>><br>
>><br>
>>> On Wed, 12 Feb 2014, Jethro R Binks wrote:<br>
>>><br>
>>> I've run this nightly for years which may help:<br>
>>><br>
>>><br>
>>> #!/bin/sh<br>
>>> ##<br>
>>> ## MailScanner, SpamAssassin and so on tend to leave files around, so this<br>
>>> ## will clean up any more than $days old<br>
>>> ##<br>
>>> ## v2.1<br>
>>><br>
>>> # Defined in MailScanner.conf, "Incoming Work Dir":<br>
>>> MSWORK=/mail/scanner/incoming<br>
>>> # Defined in MailScanner.conf, "SpamAssassin Temporary Dir":<br>
>>> #SATMP=/tmp<br>
>>> SATMP=$MSWORK/SpamAssassin-Temp<br>
>>> # Defined in clamd.conf, "TemporaryDirectory":<br>
>>> CLAMAVTMP=/var/tmp<br>
>>><br>
>>> days="2"<br>
>>><br>
>>> opts="-mtime +$days -maxdepth 1"<br>
>>><br>
>>> find $SATMP -name '.spamassassin*' $opts | xargs rm -rf<br>
>>> find $SATMP -name 'update_spamassassin*' $opts | xargs rm -rf<br>
>>> find $MSWORK -name '[0-9]*' -type d $opts | xargs rm -rf<br>
>>> find $CLAMAVTMP -name 'packlist.*' -type f $opts | xargs rm -rf<br>
>>> find $CLAMAVTMP -name 'checkholddir.*' -type f $opts | xargs rm -rf<br>
>>> find $CLAMAVTMP -name 'clamav-*' $opts | xargs rm -rf<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>>> On Wed, 12 Feb 2014, Remco Barendse wrote:<br>
>>>><br>
>>>> I know the subject was discussed on the mailing list several times but i<br>
>>>> didn't find the ultimate solution.<br>
>>>><br>
>>>> Does anyone have a super duper cleanup script for all the files in :<br>
>>>><br>
>>>> /tmp<br>
>>>> for files like tmp.DPhoj31724<br>
>>>><br>
>>>> /var/spool/MailScanner/incoming/SpamAssassin-Temp<br>
>>>> for files like .spamassassin3805xUDKuUtmp<br>
>>>> MailScanner.0aOrDx<br>
>>>> tmp.IKiiOy6683<br>
>>>><br>
>>>> They are seriously clogging up my filesystem and slowing down the system.<br>
>>>><br>
>>>> I tried to script something based on the age of the file but it didn't<br>
>>>> work (maybe because most are zero byte files).<br>
>>>><br>
>>>> Thanks!<br>
>>>><br>
>>>> Remco<br>
>>>> --<br>
>>>> MailScanner mailing list<br>
>>>> <a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
>>>> <a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
>>>><br>
>>>> Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
>>>><br>
>>>> Support MailScanner development - buy the book off the website!<br>
>>>><br>
>>><br>
>>> . . . . . . . . . . . . . . . . . . . . . . . . .<br>
>>> Jethro R Binks, Network Manager,<br>
>>> Information Services Directorate, University Of Strathclyde, Glasgow, UK<br>
>>><br>
>>> The University of Strathclyde is a charitable body, registered in<br>
>>> Scotland, number SC015263.<br>
>>><br>
>> --<br>
>> MailScanner mailing list<br>
>> <a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
>> <a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
>><br>
>> Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
>><br>
>> Support MailScanner development - buy the book off the website!<br>
--<br>
MailScanner mailing list<br>
<a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.info</a><br>
<a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" target="_blank">http://lists.mailscanner.info/mailman/listinfo/mailscanner</a><br>
<br>
Before posting, read <a href="http://wiki.mailscanner.info/posting" target="_blank">http://wiki.mailscanner.info/posting</a><br>
<br>
Support MailScanner development - buy the book off the website!<br>
</blockquote></div>