天天看點

CentOS7下/tmp目錄裡面的檔案預設保留多久

早上有同僚問了下CentOS7下/tmp目錄下檔案目錄保留多久,我記得CentOS6下預設好像是30天,CentOS7下不太确認,是以查了下:

<code>[root@kvm02 tmpfiles.d]</code><code># cd /usr/lib/tmpfiles.d/</code>

<code>[root@kvm02 tmpfiles.d]</code><code># ls</code>

<code>abrt.conf                 iscsi.conf           net-snmp.conf         rpcbind.conf         spice-vdagentd.conf   tuned.conf</code>

<code>cups.conf                 legacy.conf          openlmi-storage.conf  rpm.conf             svnserve.conf         var.conf</code>

<code>cups-lp.conf              libselinux.conf      pam.conf              samba.conf           systemd.conf          x11.conf</code>

<code>etc.conf                  libstoragemgmt.conf  ppp.conf              sap.conf             systemd-nologin.conf</code>

<code>gvfsd-fuse-tmpfiles.conf  lvm2.conf            python.conf           selinux-policy.conf  tmp.conf</code>

<code>initscripts.conf          mdadm.conf           radvd.conf            setroubleshoot.conf  tog-pegasus.conf</code>

<code>[root@kvm02 tmpfiles.d]</code><code># cat /usr/lib/tmpfiles.d/tmp.conf </code>

<code>#  This file is part of systemd.</code>

<code>#</code>

<code>#  systemd is free software; you can redistribute it and/or modify it</code>

<code>#  under the terms of the GNU Lesser General Public License as published by</code>

<code>#  the Free Software Foundation; either version 2.1 of the License, or</code>

<code>#  (at your option) any later version.</code>

<code># See tmpfiles.d(5) for details</code>

<code># Clear tmp directories separately, to make them easier to override</code>

<code>v</code> <code>/tmp</code> <code>1777 root root 10d</code>

<code>v</code> <code>/var/tmp</code> <code>1777 root root 30d</code>

<code># 預設保留時間變為了10天,如果這10天内沒做任何調整,估計會被幹掉</code>

<code># Exclude namespace mountpoints created with PrivateTmp=yes</code>

<code>x </code><code>/tmp/systemd-private-</code><code>%b-*</code>

<code>X </code><code>/tmp/systemd-private-</code><code>%b-*</code><code>/tmp</code>

<code>x </code><code>/var/tmp/systemd-private-</code><code>%b-*</code>

<code>X </code><code>/var/tmp/systemd-private-</code><code>%b-*</code><code>/tmp</code>

CentOS6的配置檔案是在/etc/cron.daily下,有興趣的朋友自己查下,網上資料比較多

參考資料:

<a href="https://developers.redhat.com/blog/2016/09/20/managing-temporary-files-with-systemd-tmpfiles-on-rhel7/" target="_blank">https://developers.redhat.com/blog/2016/09/20/managing-temporary-files-with-systemd-tmpfiles-on-rhel7/</a>

http://blog.csdn.net/zhidetian/article/details/51906335

本文轉自 冰凍vs西瓜 51CTO部落格,原文連結:http://blog.51cto.com/molewan/1983723,如需轉載請自行聯系原作者

繼續閱讀