日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CentOS7的/tmp目录自动清理规则(转)

發布時間:2023/12/18 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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目录自动清理规则(转)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。