A downtime accident caused by System Mail

Source: Internet
Author: User

The server went down. At midnight, I was called by phone. I went online to find a problem and waited until Nima was finished !! Yes !!~ _~

 

------------------- Sad cut line -----------------------

Symptom:

The system/directory was accidentally filled, and it was found that the/var/spool directory was too large.

 

Analysis:

Spool stores the System Mail! Not email !) By viewing the mail content, it is found that it is caused by cron.

The system automatically sends a mail to the root user by default because this machine adds a monitoring interface to the/etc/crontab for scheduled calls and frequent calls with invocation commands and execution output.

 

You can view the beginning of the/etc/crontab file.

 

Shell =/bin/bash
Path =/sbin:/bin:/usr/sbin:/usr/bin
Mailto = root ------------- "is here
Home =/

Can I simply close the mail sending service? For example, service Sendmail stop

But, after the mail is generated, it will not be sent, and will be directly accumulated into the system queue (/var/spool/clientmqueue/), it will also cause the disk to be fully written.

Swollen?

 

Solution:

At present, the best solution is to prevent the command from having any output, or redirect the command output to an empty location, that is, add

>/Dev/null 2> & 1

That is, discard the execution result of the command and discard the errors.

Over!

 

------------------- Sad cut line -----------------------

Nima sang, a technical child, cannot afford it !!! The previous generation of paper is full of wings !!! Yes !!! Yes !!!

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.