CentOS 7 Tmpwatch
I have noticed that tmpwatch isn’t automatically installed with CentOS 7, or at least it wasn’t when I set up this computer.
I further noticed that the CentOS 7 tmpwatch rpm no longer includes /etc/cron.daily/tmpwatch
I suspect that at least part of the reason for this is because the /tmp directory is now mounted as a tmpfs by default, so it’s automatically cleared when the machine is rebooted.
However, this does nothing to maintain /var/tmp and /var/cache
Installing the CentOS 7 tmpwatch rpm and copying the /etc/cron.daily/tmpwatch file from a CentOS 6 installation onto a CentOS 7 machine might not be particularly wise because the excluded directories listed in the CentOS 6 tmpwatch script don’t include such things as the systemd-private* directories that should probably not be made to disappear on a CentOS 7 installation.
This leads to two questions: Is tmpwatch even required on CentOS 7 anymore, or has it been superseded somehow? And if it is required (or a good idea), is there an updated script to put into /etc/cron.daily that accounts for directories and files that should not be molested by tmpwatch?
2 thoughts on - CentOS 7 Tmpwatch
There’s no need for the tmpwatch cron job because systemd-tmpfiles does its job. Read the ‘tmpfiles.d’ man page. Configuration for the temp directories is in /usr/lib/tmpfiles.d/tmp.conf, and you can add your own files in /etc/tmpfiles.d/*.conf.
Today I have learned something new; many thanks to you.