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&BbsC...
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.
# rm -rf /var/spool/clientmqueue/*
# 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
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.
# rm -rf /var/spool/clientmqueue/*
# 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@us-cfe002:/tmp]$ cat test.sh #!/bin/bash rm -fv $1 echo "Sleeping 1 second" sleep 1
[natea@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
Heh - I always preferred the indirect approach. Move the dir out of the way, recreate it, and delete in your own time...
# service sendmail stop # cd /var/spool # mv clientmqueue clientmqueue-todelete # mkdir clientmqueue # chown --reference=clientmqueue-todelete clientmqueue # chmod --reference=clientmqueue-todelete clientmqueue # service sendmail start # rm -rf clientmqueue-todelete
-I
On Mon, 2009-08-31 at 14:57 -0700, nate wrote:
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@us-cfe002:/tmp]$ cat test.sh #!/bin/bash rm -fv $1 echo "Sleeping 1 second" sleep 1
[natea@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
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Hi,
"nate" centos@linuxpowered.net schrieb am 31.08.2009 23:57:09:
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 {} ;
You probably want to do
find /var/spool/clientmqueue -type f -exec rm -f {} +
to reduce your load or if your find(1) isn't POSIX compliant:
find /var/spool/clientmqueue -type f -print0 | xargs -0 rm -f
If the load is of a problem use nice(1). Though I thought sendmail brings a way on its own to delete messages from the queue, which I would then prefer to use.
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 -
You can't give 2 commands to find's -exec and
[natea@us-cfe002:/tmp]$ cat test.sh #!/bin/bash rm -fv $1 echo "Sleeping 1 second" sleep 1
I strongly recommend mounting /tmp as nosuid,nodev *and* noexec, especially on a server.
HTH, Frank.
On Tue, 2009-09-01 at 09:12 +0200, Frank.Brodbeck@klingel.de wrote:
<snip>
You probably want to do
find /var/spool/clientmqueue -type f -exec rm -f {} +
Or the variant ... -execdir command {} + might be preferable.
It claims to avoid potential race conditions and warns about $PATH setting.
to reduce your load or if your find(1) isn't POSIX compliant:
find /var/spool/clientmqueue -type f -print0 | xargs -0 rm -f
<snip>
HTH, Frank.
<snip sig stuff>
Frank, I need to re-read man pages more than once every decade or so. I didn't know they had added new forms of exec.
Thanks,