CentOS7的/tmp目录自动清理规则(转)
生活随笔
收集整理的這篇文章主要介紹了
CentOS7的/tmp目录自动清理规则(转)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
CentOS7的/tmp目錄自動清理規則
CentOS6以下系統(含)使用watchtmp + cron來實現定時清理臨時文件的效果,這點在CentOS7發生了變化,在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文件的設定,默認的配置內容為:
# 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 v /tmp 1777 root root 10d # 清理/tmp下10天前的目錄和文件 v /var/tmp 1777 root root 30d # 清理/var/tmp下30天前的目錄和文件 # 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我們可以配置這個文件,比如你不想讓系統自動清理/tmp下以tomcat開頭的目錄,那么增加下面這條內容到配置文件中即可:
x /tmp/tomcat.*轉:https://blog.51cto.com/kusorz/2051877?utm_source=oschina-app
轉載于:https://www.cnblogs.com/ql211lin/p/10576524.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的CentOS7的/tmp目录自动清理规则(转)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jquery控制css的display(
- 下一篇: Java 集合系列(一)