Clean up script for tmp files

Jethro R Binks jethro.binks at strath.ac.uk
Wed Feb 12 12:21:46 GMT 2014


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