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