mqueue.in cleanup
Steve Campbell
campbell at cnpapers.com
Thu Jan 15 19:37:40 GMT 2009
I think the following might work:
find /var/spool/mqueue.in/q* -empty -mtime +14 -type f -exec rm '{}' ';'
You might need to change -empty to "-size 0c" as it's not exactly what I
use, so test it first.
steve
Sergio Rabellino wrote:
> my 5 cent... (for sendmail only I think)
>
>> #!/bin/sh
>> # remove zero length qf files
>> cd /anywhere/usr/var/mqueue.in
>>
>> for qffile in qf*
>> do
>> if [ \-r $qffile ]
>> then
>> if [ ! \-s $qffile ]
>> then
>> echo " <zero: $qffile>"
>> rm \-f $qffile
>> fi
>> fi
>> done
>> # rename tf files to be qf if the qf does not exist
>> for tffile in tf*
>> do
>> qffile=`echo $tffile | sed 's/t/q/'`
>> if [ \-r $tffile \-a ! \-f $qffile ]
>> then
>> echo " <recovering: $tffile>"
>> mv $tffile $qffile
>> else
>> if [ \-f $tffile ]
>> then
>> echo " <extra: $tffile>"
>> rm \-f $tffile
>> fi
>> fi
>> done
>> # remove df files with no corresponding qf files
>> for dffile in df*
>> do
>> qffile=`echo $dffile | sed 's/d/q/'`
>> if [ \-r $dffile \-a ! \-f $qffile ]
>> then
>> echo " <incomplete: $dffile>"
>> mv $dffile `echo $dffile | sed 's/d/D/'`
>> fi
>> done
>> # announce files that have been saved during disaster recovery
>> for xffile in xf*
>> do
>> if [ \-f $xffile ]
>> then
>> echo " <panic: $xffile>"
>> fi
>> done
>
>
> Jan Agermose ha scritto:
>>
>> hi
>>
>> I have a problem on my server in that mqueue.in fills with old files
>> that are never removed - files back one year - I think its safe to
>> say they will not get delivered.
>>
>> Is there som "find" command that can remove all files older than 14
>> dayes if its safe to do so or should I clean up in some other way?
>>
>>
>>
>> regards
>>
>> Jan
>>
>>
>>
>>
>>
>
> --
> Ing. Sergio Rabellino
>
> Università degli Studi di Torino
> Dipartimento di Informatica
> ICT Services Director
> Tel +39-0116706701 Fax +39-011751603
> C.so Svizzera , 185 - 10149 - Torino
>
> <http://www.di.unito.it>
>
More information about the MailScanner
mailing list