Clean up script for tmp files

Remco Barendse mailscanner at barendse.to
Fri Feb 14 13:47:52 GMT 2014


Hi Jethro,

When i run the script i get this message :

---
find: warning: you have specified the -maxdepth option after a non-option 
argument -mtime, but options are not positional (-maxdepth affects tests 
specified before it as well as those specified after it).  Please specify 
options before other arguments.
---

I tried moving the $opts to the front but that didn't help.

Where am i going wrong?

Cheers!

On Wed, 12 Feb 2014, Jethro R Binks wrote:

> I've run this nightly for years which may help:
>
>
> #!/bin/sh
> ##
> ## 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":
> MSWORK=/mail/scanner/incoming
> # Defined in MailScanner.conf, "SpamAssassin Temporary Dir":
> #SATMP=/tmp
> SATMP=$MSWORK/SpamAssassin-Temp
> # Defined in clamd.conf, "TemporaryDirectory":
> CLAMAVTMP=/var/tmp
>
> days="2"
>
> 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 :
>>
>> /tmp
>> for files like  tmp.DPhoj31724
>>
>> /var/spool/MailScanner/incoming/SpamAssassin-Temp
>> for files like  .spamassassin3805xUDKuUtmp
>>                  MailScanner.0aOrDx
>>                  tmp.IKiiOy6683
>>
>> 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).
>>
>> Thanks!
>>
>> Remco
>> --
>> MailScanner mailing list
>> mailscanner at lists.mailscanner.info
>> http://lists.mailscanner.info/mailman/listinfo/mailscanner
>>
>> 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 mailing list