CentOS7/tmp directory automatic cleanup rules
CentOS6 the following systems (including) use Watchtmp + cron to achieve the effect of scheduled cleanup of temporary files, which changed in CentOS7, under CentOS7, the system uses SYSTEMD management of volatile and temporary files, related to the system services have 3:
Systemd-tmpfiles-setup.service : Create Volatile Files and directories
Systemd-tmpfiles-setup-dev.service:create static device nodes In/dev
systemd-tmpfiles-clean.service:cleanup of Temporary directories
The relevant configuration file also has 3 places:
/etc/tmpfiles.d/*.conf
/run/tmpfiles.d/*.conf
/usr/lib/tmpfiles.d/*.conf
The clean-up rule of the/TMP directory depends primarily on the settings of the/usr/lib/tmpfiles.d/tmp.conf file, with the default configuration:
# This file was part of Systemd.
#
# systemd is free software, you can redistribute it and/or modify it
# under the terms of the GNU Lesser General public License
as published by # the free software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See TMPFILES.D (5) For details
# Clear TMP directories separately, to make them easier to override
V/tmp 1777 root root 10d # clean up directories and files from/tmp 10 days ago
v/var/tmp 1777 root root 30d # Clean/var/tmp directories and files 30 days ago
# Exclude namespace mountpoints created with Privatetmp=yes
x/tmp/systemd-private-%b-*
x/tmp/ Systemd-private-%b-*/tmp
x/var/tmp/systemd-private-%b-*
x/var/tmp/systemd-private-%b-*/tmp
We can configure this file, for example, if you don't want the system to automatically clean up directories that start with Tomcat in/TMP, add the following to the configuration file:
x/tmp/tomcat.*
Therefore, the data is not saved in/tmp