In Linux, crontab cannot be saved-Linux general technology-Linux technology and application information. For details, refer to the following section. Solution: huqinfen
Today, I want to modify the content in the crontab. I found the prompt "no space left on device". However, after df's space, I found that no space is full, and at most it is 60%. What is the problem?
I searched the internet and said it was possible that most of the small files were used up, and the file inode was used up. Even if there was still disk space, it was impossible to create new files.
Du has gone through the/var directory and found that the spool directory does not move. After ctrl + c is dropped, it is found that there is a clientmqueue directory under the spool directory, and ls is done. Well, I guess there are some files. Then, continue searching on the Internet. What is the use of this directory?
The search result is as follows:
Symptom: a large number of files exist in the/var/spool/clientmqueue/directory of the linux operating system.
Cause Analysis: some users in the system have enabled cron, while the Program executed in cron has output content, and the output content will be sent to cron users by email, sendmail does not start, so these files are generated;
Solution: Add>/dev/null 2> & 1 to the command in crontab.
2> & 1: redirect the error to the place where the output is to be sent. That is, the execution result of the above command is redirected to/dev/null, that is, discard, and also discard the errors.
After reading the content in crontab, haha, it turns out that some people have not targeted the content and errors output by the program, as a result, each time you run the crontab program, a small file is generated under/var/spool/clientmqueue/. In fact, there are two other programs that are executed every minute. Basically, nearly 20 million files are generated every day, oh, terrible!
Next, delete the files under/var/spool/clientmqueue! Here is another tips:
Cd/var/spool/clientmqueue
If there are too many files that occupy too much space, use the rm command to delete them slowly. Run the following command: ls | xargs rm-f.
Now that you have space, you can modify crontab. First, add>/dev/null 2> & 1 to all crontab objects without targeted output. Otherwise, several minutes later/var/spool/clientmqueue/has some other files.
Finally, add the content in the crontab to be modified.
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