一時ファイル(/tmp)の設定に影響を与える方法

一時ファイル(/tmp)の設定に影響を与える方法

トピック - 一時ファイル遅延のための新しい設定(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には削除された内容はまったく表示されません。

再起動する必要がありますか、この新しい設定に影響を与える他の操作を実行する必要がありますか?

引用する -

https://developers.redhat.com/blog/2016/09/20/managing-temporary-files-with-systemd-tmpfiles-on-rhel7/

文書:

[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

ベストアンサー1

おすすめ記事