Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Backup files under the tmp directory are deleted periodically

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The Centos/RHEL/Fedora system is fully installed, and there is a cleaning mechanism in the system. Files in the / tmp directory will be cleaned regularly.

Centos/RHEL/Fedora system minimization installation does not have this mechanism

Tool used: tmpwatch

Yum install tmpwatch-y

Contains the following files:

/ etc/cron.daily/tmpwatch

/ usr/bin/tmpwatch

/ usr/sbin/tmpwatch

/ usr/share/doc/tmpwatch-2.9.16

/ usr/share/doc/tmpwatch-2.9.16/COPYING

/ usr/share/doc/tmpwatch-2.9.16/ChangeLog

/ usr/share/doc/tmpwatch-2.9.16/NEWS

/ usr/share/doc/tmpwatch-2.9.16/README

/ usr/share/man/man8/tmpwatch.8.gz

The function of the tmpwatch command is to delete files that are not in use for a period of time

After installation, a tmpwatch file is generated in the / etc/cron.daily/ directory. The contents are as follows:

[root@LAMP linuxuser] # ls / etc/cron.daily/

Logrotate makewhatis.cron mlocate.cron tmpwatch

#! / bin/shflags=-umc/usr/sbin/tmpwatch "$flags"-x / tmp/.X11-unix-x / tmp/.XIM-unix\-x / tmp/.font-unix-x / tmp/.ICE-unix-x / tmp/.Test-unix\-X'/ tmp/hsperfdata_*'-X'/ tmp/.hdb*lock'-X'/ tmp/.sapstartsrv*.log'\-X'/ tmp / pymp-*' 10d / tmp/usr/sbin/tmpwatch "$flags" 30d / var/tmpfor d in/ var/ {cache/man Catman} / {cat?,X11R6/cat?,local/cat?} Do if [- d "$d"]; then / usr/sbin/tmpwatch "$flags"-f 30d "$d" fidone

As you can see from the script, the tmp directory deletes files that have not been accessed for 10 days.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

  • How to implement one-click migration script in osd journal

    This article mainly introduces osd journal how to achieve one-click migration script, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report