Management of temporary files:
[root@foundation21 cron.d]# cd /usr/lib/tmpfiles.d/ switch path
[root@foundation21 tmpfiles.d]# vim westos.conf
[root@foundation21 tmpfiles.d]# cat westos.conf
d /mnt/westos 1777 root root 15s After more than 15 seconds, the files will be deleted one by one
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --create /usr/lib/tmpfiles.d/*
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --clean /usr/lib/tmpfiles.d/* 清除
[root@foundation21 tmpfiles.d]# mkdir /mnt/westos
[root@foundation21 tmpfiles.d]# touch /mnt/westos/file to create a file
[root@foundation21 tmpfiles.d]# touch /mnt/westos/file1
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --clean /usr/lib/tmpfiles.d/* If the time exceeds, it will be deleted one by one, as shown in the following figure:
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --clean /usr/lib/tmpfiles.d/*
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --clean /usr/lib/tmpfiles.d/*
[root@foundation21 tmpfiles.d]# systemd-tmpfiles --clean /usr/lib/tmpfiles.d/*