主题 - 延迟临时文件的新设置(redhat 7.2)
我们在以下配置文件中设置了新值,以尽量减少 /tmp 容量
在文件中:
/lib/systemd/system/systemd-tmpfiles-clean.timer
我们设置新值
OnUnitActiveSec=1h
在文件中:
/usr/lib/tmpfiles.d/tmp.conf
我们设置以下新值
v /tmp 1777 root root 1d
所以
每个文件夹/文件如果超过 1 天将被删除
服务每 1 小时启动一次
但 1 小时后,我们仍然没有看到 /tmp 中有任何删除
我们是否需要重新启动/其他操作,这会影响此新设置?
参考 -
文件:
[root@master tmp]# more /lib/systemd/system/systemd-tmpfiles-clean.timer
# This file is 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.
[Unit]
Description=Daily Cleanup of Temporary Directories
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
[Timer]
OnBootSec=15min
OnUnitActiveSec=1h <--- NEW VALUE
[root@master tmp]# more /usr/lib/tmpfiles.d/tmp.conf
# This file is 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 1d <--- NEW VALUE
v /var/tmp 1777 root root 30d
# 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
例如 /tmp 下我们还有什么
drwx------ 2 hive hadoop 6 Dec 9 09:34 7e09d25b-d5d2-4822-bdb1-4e2b466f9df6_resources
drwx------ 2 hive hadoop 6 Dec 9 09:39 0dad9456-f507-49ab-91c8-727185aab5c8_resources
drwx------ 2 hive hadoop 6 Dec 9 09:44 52dc22ca-a08d-43d9-90e2-1eaf5298f3d5_resources
drwx------ 2 hive hadoop 6 Dec 9 09:49 1880ce4e-6942-4544-9587-0218beca10b0_resources
drwx------ 2 hive hadoop 6 Dec 9 09:54 df3c7df8-b895-4936-8ef0-55d1d7929b68_resources
drwx------ 2 hive hadoop 6 Dec 9 09:59 2320223f-3adb-44b0-bdc1-b62543eda1dd_resources
drwx------ 2 hive hadoop 6 Dec 9 10:04 5045f954-c1f5-418f-829d-52bcbcbd5178_resources
drwx------ 2 hive hadoop 6 Dec 9 10:09 5d225ff0-49e8-4c70-90fd-53b2a2bf7bad_resources
drwx------ 2 hive hadoop 6 Dec 9 10:14 50875956-c42e-4e15-9834-424bb0aa605d_resources
drwx------ 2 hive hadoop 6 Dec 9 10:19 e5140787-3d0d-4177-a3f4-f8a0ea3086c7_resources
drwx------ 2 hive hadoop 6 Dec 9 10:24 83e7d524-f28f-49c3-9b1f-213d5b735a3c_resources
drwx------ 2 hive hadoop 6 Dec 9 10:29 24783890-d34d-4224-863e-2ce8e29a0876_resources
drwx------ 2 hive hadoop 6 Dec 9 10:34 cd81af78-4df4-462a-8abc-94bf1ef513d3_resources
drwx------ 2 hive hadoop 6 Dec 9 10:39 b398e25f-c224-4d95-a3df-ecb61cba1f55_resources
drwx------ 2 hive hadoop 6 Dec 9 10:44 635bdb61-064e-43c1-ba37-4bb30f2ce5be_resources
drwx------ 2 hive hadoop 6 Dec 9 10:49 c9e8b1b3-543e-45f4-8bda-3d688cce0422_resources
drwx------ 2 hive hadoop 6 Dec 9 10:54 1fc8e739-a8e6-4b10-a362-1e91f388ba64_resources
drwx------ 2 hive hadoop 6 Dec 9 10:59 bf377a4a-e7f3-48f4-b71d-fd6f4752dd7b_resources
drwx------ 2 hive hadoop 6 Dec 9 11:04 29996e42-be03-444f-85ea-23c24e22d951_resources
# date
Wed Dec 19 18:27:35 UTC 2018