How to delete a large number of files generated by SendMail in the var/spool/clientmqueue/directory
Failure phenomenon:
As soon as I came here this morning, Tw_ldj told me that the/var partition of the project machine had been used over 85%
Reason Analysis:
Why is this directory so big? This is going to start with the role of the/var/spool/clientmqueue/directory. When you use a simple sendmail to send a message, or the system defaults to send some mail (such as cron Mail), the first copy of the message to this directory, and then wait for the MTA (Mail transfer agent) to process, What the MTA does is usually get the mail in this directory into/var/spool/mqueue, and then send it to the real destination. A very large case of/var/spool/clientmqueue/is often accumulated here because there is no appropriate MTA to send mail, and if the mail is not what you need, such as what cron letters run every minute of the system default, you can simply erase them.
Solution:
1, the crontab inside the command after the addition of >/dev/null 2>&1
2, clear the/var/spool/clientmqueue/directory of files:
# Cd/var/spool/clientmqueue
# RM-RF * or ls | Xargs rm–f
If there are too many files, these two commands may have too many error prompts, you can use the following method:
# Find/var/spool/clientmqueue | Xargs rm–f//The disadvantage of this is very much a system resource
# rm–rf/var/spool/clientmqueue//delete, then manually create one, and set the owner and permissions
Note:
We delete this directory before the file, it is best to stop the sendmail, otherwise, directly remove the possibility of space can not be directly released, the need to uninstall the/var directory corresponding to the partition, this will be very troublesome.