[CentOS] centos7 tmpfiles.d deleted outdate files

Gordon Messmer

gordon.messmer at gmail.com
Thu May 26 18:12:15 UTC 2016


On 05/24/2016 11:18 PM, Qiang Chen wrote:
> #Type Path    Mode  UID   GID   Age   Arg
> d /chenqiang 0775 root root 10s
> f /chenqiang/test_10s 0660 root root 10s
> f /chenqiang/test_20s 0660 root root 20s
> ```
>
> It can delete dir if the age > 10s, but can't delete the files in it. 


The man page for tmpfiles.d says, of the age field:
"The age field only applies to lines starting with d, D, and x."

So, the line:

d /chenqiang/test_10s 0660 root root 10s

indicates that systemd-tmpfiles should create the directory 
/chenqiang/test_10s, owned by root/root with mode 0660, and periodically 
clean it of files and empty directories more than 10s old.

Note that the default configuration runs systemd-tmpfiles once per day, 
so specifying time periods much smaller than that may not be useful.




More information about the CentOS mailing list