0

subject - new settings retarding temporary files ( redhat 7.2 )

we set new values on the following configuration files , in order to minimize /tmp capacity

in file:

 /lib/systemd/system/systemd-tmpfiles-clean.timer 

we set new value

OnUnitActiveSec=1h   

in file:

 /usr/lib/tmpfiles.d/tmp.conf

we set the following new value

v /tmp 1777 root root 1d

so

every folder/files will be deleted if they are old then 1 day

and service will be activate each 1 hour

but after 1h , still we not see any deletion from /tmp

do we need to restart / other action , that will take affected of this new settings ?

reference -

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

the files:

[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

example what we still have under /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
    The obvious question is whether there are any files older than one day, and also whether the service is looking at ctime, mtime or atime. – Kusalananda Dec 19 '18 at 18:24
  • yes there are files and folder that older then 10 days – yael Dec 19 '18 at 18:25
  • see my update please in the post – yael Dec 19 '18 at 18:27
  • yes but these are old files , so what could be the reason that service not deleted them – yael Dec 19 '18 at 18:50
  • do we need some additional steps after our settings ? – yael Dec 19 '18 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.