[CentOS] centos7 tmpfiles.d deleted outdate files

Qiang Chen

qzschen at gmail.com
Mon May 30 11:16:55 UTC 2016


so, there no method to delete special files that below a directory?

such as in the directory

[root at chenqiang]# tree
.
├── test_10d
└── test_20d

0 directories, 2 files
[root at chenqiang]# ll
total 8
-rw-r--r-- 1 root root 4 5月  20 19:14 test_10d
-rw-r--r-- 1 root root 4 5月  10 19:15 test_20d



So, I want to delete file test_20d, keep test_10d, how to do that? thx.





On 2016年05月27日 02:12, Gordon Messmer wrote:
> Boxbe <https://www.boxbe.com/overview> This message is eligible for 
> Automatic Cleanup! (gordon.messmer at gmail.com) Add cleanup rule 
> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3Dcj6TIIH2JCApBZSDfyWJ8iQEI%252BX4EXjdlT1Hn%252Bg1S2k%253D%26token%3D9azxLv8qsCT3SJ8yOuS45fGCsimKKw%252FBBlrzM50NWAafA%252BeFZ8b8gyIlyRYLmG3Eui34w2DE0rYrFj82WbDOBqXqDZJvxmXH%252FKGVgyhWIq5zDsXrCJHzEyfvYCAisQ00%252FTCvthmPrgxu9vouzTiaCg%253D%253D&tc_serial=25543758553&tc_rand=2024237295&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> 
> | More info 
> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=25543758553&tc_rand=2024237295&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001> 
>
> 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.
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos

-- 
Best Regards,
Chen, Qiang




More information about the CentOS mailing list