I'd like to investigate when files in /tmp get removed. I run CentOS 7. Policy regarding deleting files from that directory is governed as follows:
RHEL7 and RedHat-like with systemd it's configured in
/usr/lib/tmpfiles.d/tmp.conf, called by systemd-tmpfiles-clean.service)
I guess that three-year-old files are old enough to be deleted. So I set access time this way
find /tmp/payaramicro*tmp -exec touch -m -a -t 201512180130.09 {} \;
However, when I run systemd-tmpfiles --clean
those files won't get deleted. Why? Perhaps it has something to do with their dates as stat some-file
shows today's date in one of its lines in output:
Access: 2015-12-18 01:30:09.000000000 +0100
Modify: 2015-12-18 01:30:09.000000000 +0100
Change: 2018-04-18 12:20:54.095962410 +0200
Best Answer
Yes,
systemd-tmpfiles --clean
considers change times too. You can see this by running it with debug logs enabled:You’ll see it mentioning that the change time is too new.