centos7中/tmp文件保存天数

不要在/tmp目录下保存文件,该目录会定期清理文件

/tmp默认保存10天

/var/tmp默认保存30天

配置文件:/usr/lib/tmpfiles.d/tmp.conf

默认配置文件:
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

# See tmpfiles.d(5) for details

# Clear tmp directories separately, to make them easier to override
# 默认保留时间变为了10天,如果这10天内没做任何调整,会被处理
v /tmp 1777 root root 10d
v /var/tmp 1777 root root 30d

# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
X /tmp/systemd-private-%b-*/tmp
x /var/tmp/systemd-private-%b-*
X /var/tmp/systemd-private-%b-*/tmp

原文地址:https://www.cnblogs.com/szy2018/p/10370524.html