Centos7的/tmp目录自动清理规则
在CentOS7下,系统使用systemd管理易变与临时文件,与之相关的系统服务有3个:
systemd-tmpfiles-setup.service:Create Volatile Files and Directories
systemd-tmpfiles-setup-dev.service: Create static device nodes in /dev
systemd-tmpfiles-clean.service :cleanup of Temporary Directories
相关的配置文件也有3个地方:
/etc/tmpfiles.d/*.conf
/run/tmpfiles.d/*.conf
/usr/lib/tmpfiles.d/*.conf
/tmp目录的清理规则主要取决于/usr/lib/tmpfiles.d/tmp.conf文件的设定,默认的配置内容为:
v /tmp 1777 root root 10d # 清理rmp下10天前的目录和文件
v /var/tmp 1777 root root 30d #清理vartmp下30天前的目录和文件
解决方案:我们可以配置这个文件,比如不想让系统自动清理/tmp下以tomcat开头的目录,那么增加下面这条内容到配置文件中即可:
x /tmp/tomcat.*

1050

被折叠的 条评论
为什么被折叠?



