주제 - 임시 파일 지연을 위한 새로운 설정(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시간이 지난 후에도 /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