MontyRee
2009-Aug-29 02:17 UTC
[CentOS] what is the best way to delete so many queue files?
Hello, all. I found that so many unnessary queue files are saved at /var/spool/clientmqueue/ directory. I tested two way to delete these files. 1. # rm -rf /var/spool/clientmqueue/* 2. # cd /var/spool/clientmqueue/ ; find . | xargs rm -fv But this makes a few load of the system and took too much time to delete. What is the best way to delete fast without too much load? Thanks in advance. _________________________________________________________________ ??? ????? ?? ???? ?? ?? ??? ?? ?????! http://im.msn.co.kr/im/main/mainCoverDetail.asp?seq=2251&page=1&BbsCode=bbs01&ser_k=a&ser_v=
Alexander Dalloz
2009-Aug-29 11:28 UTC
[CentOS] what is the best way to delete so many queue files?
MontyRee schrieb:> Hello, all. > > > I found that so many unnessary queue files are saved at /var/spool/clientmqueue/ directory. > > > I tested two way to delete these files. > > 1. > # rm -rf /var/spool/clientmqueue/* > > 2. > # cd /var/spool/clientmqueue/ ; find . | xargs rm -fv > > But this makes a few load of the system and took too much time to delete. > > What is the best way to delete fast without too much load? > > > > Thanks in advance.My first question is: why do you have so many queued messages in the clientmqueue? This is not normal! Is that a result of excessive testing? About how many mail in clientmqueue are we speaking? The source of Sendmail ships with a tool called qtool.pl. Unfortunately CentOS and upstream does not package it with the sendmail.rpm. Of course it will not bypass a situation with lots of queue files in the submission queue. So, first check why you have need to delete so many queue files. Alexander
Chan Chung Hang Christopher
2009-Aug-31 13:59 UTC
[CentOS] what is the best way to delete so many queue files?
MontyRee wrote:> Hello, all. > > > I found that so many unnessary queue files are saved at /var/spool/clientmqueue/ directory. >How do you know they are unnecessary?> > > I tested two way to delete these files. > > 1. > # rm -rf /var/spool/clientmqueue/* > > 2. > # cd /var/spool/clientmqueue/ ; find . | xargs rm -fv > > But this makes a few load of the system and took too much time to delete. > > What is the best way to delete fast without too much load? > >service sendmail start?
MontyRee wrote:> What is the best way to delete fast without too much load?If you put /var on another file system you could: - go to single user mode - copy all files off of /var except those in the queue directory - re-format the file system - copy all the files back - go to multi user mode If there are a TON of files that could be much much faster than deleting them individually. otherwise: find /var/spool/clientmqueue -type f -exec rm -f {} \; Another option I've never tried passing two commands to find at the same time, but assuming doing that is not possible you could create a script that calls rm -f and sleeps a second in between each file deletion - [natea at us-cfe002:/tmp]$ cat test.sh #!/bin/bash rm -fv $1 echo "Sleeping 1 second" sleep 1 [natea at us-cfe002:/tmp]$ find blah3/ -type f -exec /tmp/test.sh {} \; removed `blah3/pd4-ads01-splunk-diag-20090827_193250.tgz' Sleeping 1 second removed `blah3/pd3-ads01-splunk-diag-20090827_183136.tgz' Sleeping 1 second removed `blah3/pd4-ads01-splunk-listtails.log' Sleeping 1 second removed `blah3/pd3-bgas01-splunk-listtails.log' Sleeping 1 second removed `blah3/pd3-ads01-splunk-listtails.log' Sleeping 1 second removed `blah3/splunk-diags-multiserver-20090827_1700.tar' Sleeping 1 second removed `blah3/pd4-bgas01-splunk-listtails.log' Sleeping 1 second removed `blah3/pd3-bgas01-splunk-diag-20090827_183148.tgz' Sleeping 1 second removed `blah3/pd4-bgas01-splunk-diag-20090827_193229.tgz' Sleeping 1 second adjust sleep level as desired.. nate