Delete a large number of files generated by SendMail in the var/spool/clientmqueue/directory

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.