4

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

6

Yes, systemd-tmpfiles --clean considers change times too. You can see this by running it with debug logs enabled:

SYSTEMD_LOG_LEVEL=debug systemd-tmpfiles --clean

You’ll see it mentioning that the change time is too new.

  • Thanks, that's it. On a side note, how do change file dates so that the file would be available for systemd-tmpfiles --clean? – menteith Apr 18 '18 at 11:17
  • You can’t control the change time (other than by changing your system’s notion of the current time). – Stephen Kitt Apr 18 '18 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.