Linux/tmp directory file cleanup rules __linux

Source: Internet
Author: User

Turn from: http://blog.itpub.net/133735/viewspace-773854/


The Hadoop system Datanode and Tasktracker's PID files are cleared.

So conveniently looked at the next,/tmp directory cleaning rules.


The Linux development specification does not explicitly indicate the cleanup rules for the/tmp directory, but specifies that the system must have a/tmp directory.

All distributions are inconsistent, and the general practice is that a host reboot clears the/tmp directory

The clean Rules for the/TMP directory are defined in Linux/etc/cron.daily/tmpwatch, different distributions are inconsistent, but there is a general customization of this timing task.

01 [Root@test740-10 cron.daily]# VI Tmpwatch
02
03 Flags=-umc
04 /usr/sbin/tmpwatch "$flags"-x/tmp/. X11-unix-x/tmp/. Xim-unix \
05 -x/tmp/.font-unix-x/tmp/. Ice-unix-x/tmp/. Test-unix 240/tmp
06 /usr/sbin/tmpwatch "$flags" 720/var/tmp
07 For D In/var/{cache/man,catman}/{cat?,x11r6/cat?,local/cat?}; Todo
08 If [-D "$d"]; Then
09 /usr/sbin/tmpwatch "$flags"-F 720 "$d"
10 Fi
11 Done


According to the man Tmpwatch this command will know. Clears the files below the/tmp directory for 30 days without access.

You can also add custom code to accomplish specific tasks in accordance with your own rules.

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.