Linux + files & folders cleanup under /tmp












4














On all my Red Hat Linux machines version 7.2 we saw that systemd-tmpfiles-clean.service is inactive:



systemctl status systemd-tmpfiles-clean.service
● systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static; vendor preset: disabled)
Active: inactive (dead) since Wed 2018-12-19 14:47:14 UTC; 12min ago
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Process: 34231 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
Main PID: 34231 (code=exited, status=0/SUCCESS)

Dec 19 14:47:14 master02.uridns.com systemd[1]: Starting Cleanup of Temporary Directories...
Dec 19 14:47:14 master02.uridns.com systemd[1]: Started Cleanup of Temporary Directories.


It is strange that we saw the files and folders under /tmp,
and it seems that cleanup is performed every some time.



I searched on crontab or cronjob, but I did not find other cleanup jobs.



Am I missing something here?



Is it possible that in spite of the service being inactive, the cleanup is performed every couple of weeks?



  systemctl enable  systemd-tmpfiles-clean.service

The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).


We also saw a few folders that were real old, as



ls -ltr
total 137452
drwxr-xr-x 3 root root 33 Jun 13 2017 Tools
drwx--x--x 3 root root 16 Oct 12 09:33 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-httpd.service-QZqGLA
drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-rtkit-daemon.service-BTcGY1
drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-vmtoolsd.service-mQ1SXc
drwxr-xr-x 2 ambari ambari 18 Oct 12 12:02 hsperfdata_ambari
drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-cups.service-PnKaq8
drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-colord.service-DNn470
-rwxr-xr-x 1 root root 83044 Nov 18 17:27 Spark_Thrift.log
drwxr-xr-x 2 zookeeper hadoop 18 Nov 18 17:28 hsperfdata_zookeeper
-rwxr-xr-x 1 root root 379 Nov 18 17:37 requests.txt
-rwxr-xr-x 1 root root 137348 Nov 22 14:50 pp
-rwxr-xr-x 1 root root 344 Nov 26 15:24 yy
prwx--x--x 1 root root 0 Nov 29 21:26 hogsuspend
-rwxr-xr-x 1 root root 1032 Dec 3 10:55 aa


From my machine:



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=1d


The rules are:



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 10d
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









share|improve this question





























    4














    On all my Red Hat Linux machines version 7.2 we saw that systemd-tmpfiles-clean.service is inactive:



    systemctl status systemd-tmpfiles-clean.service
    ● systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
    Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static; vendor preset: disabled)
    Active: inactive (dead) since Wed 2018-12-19 14:47:14 UTC; 12min ago
    Docs: man:tmpfiles.d(5)
    man:systemd-tmpfiles(8)
    Process: 34231 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
    Main PID: 34231 (code=exited, status=0/SUCCESS)

    Dec 19 14:47:14 master02.uridns.com systemd[1]: Starting Cleanup of Temporary Directories...
    Dec 19 14:47:14 master02.uridns.com systemd[1]: Started Cleanup of Temporary Directories.


    It is strange that we saw the files and folders under /tmp,
    and it seems that cleanup is performed every some time.



    I searched on crontab or cronjob, but I did not find other cleanup jobs.



    Am I missing something here?



    Is it possible that in spite of the service being inactive, the cleanup is performed every couple of weeks?



      systemctl enable  systemd-tmpfiles-clean.service

    The unit files have no [Install] section. They are not meant to be enabled
    using systemctl.
    Possible reasons for having this kind of units are:
    1) A unit may be statically enabled by being symlinked from another unit's
    .wants/ or .requires/ directory.
    2) A unit's purpose may be to act as a helper for some other unit which has
    a requirement dependency on it.
    3) A unit may be started when needed via activation (socket, path, timer,
    D-Bus, udev, scripted systemctl call, ...).


    We also saw a few folders that were real old, as



    ls -ltr
    total 137452
    drwxr-xr-x 3 root root 33 Jun 13 2017 Tools
    drwx--x--x 3 root root 16 Oct 12 09:33 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-httpd.service-QZqGLA
    drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-rtkit-daemon.service-BTcGY1
    drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-vmtoolsd.service-mQ1SXc
    drwxr-xr-x 2 ambari ambari 18 Oct 12 12:02 hsperfdata_ambari
    drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-cups.service-PnKaq8
    drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-colord.service-DNn470
    -rwxr-xr-x 1 root root 83044 Nov 18 17:27 Spark_Thrift.log
    drwxr-xr-x 2 zookeeper hadoop 18 Nov 18 17:28 hsperfdata_zookeeper
    -rwxr-xr-x 1 root root 379 Nov 18 17:37 requests.txt
    -rwxr-xr-x 1 root root 137348 Nov 22 14:50 pp
    -rwxr-xr-x 1 root root 344 Nov 26 15:24 yy
    prwx--x--x 1 root root 0 Nov 29 21:26 hogsuspend
    -rwxr-xr-x 1 root root 1032 Dec 3 10:55 aa


    From my machine:



    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=1d


    The rules are:



    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 10d
    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









    share|improve this question



























      4












      4








      4


      2





      On all my Red Hat Linux machines version 7.2 we saw that systemd-tmpfiles-clean.service is inactive:



      systemctl status systemd-tmpfiles-clean.service
      ● systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
      Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static; vendor preset: disabled)
      Active: inactive (dead) since Wed 2018-12-19 14:47:14 UTC; 12min ago
      Docs: man:tmpfiles.d(5)
      man:systemd-tmpfiles(8)
      Process: 34231 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
      Main PID: 34231 (code=exited, status=0/SUCCESS)

      Dec 19 14:47:14 master02.uridns.com systemd[1]: Starting Cleanup of Temporary Directories...
      Dec 19 14:47:14 master02.uridns.com systemd[1]: Started Cleanup of Temporary Directories.


      It is strange that we saw the files and folders under /tmp,
      and it seems that cleanup is performed every some time.



      I searched on crontab or cronjob, but I did not find other cleanup jobs.



      Am I missing something here?



      Is it possible that in spite of the service being inactive, the cleanup is performed every couple of weeks?



        systemctl enable  systemd-tmpfiles-clean.service

      The unit files have no [Install] section. They are not meant to be enabled
      using systemctl.
      Possible reasons for having this kind of units are:
      1) A unit may be statically enabled by being symlinked from another unit's
      .wants/ or .requires/ directory.
      2) A unit's purpose may be to act as a helper for some other unit which has
      a requirement dependency on it.
      3) A unit may be started when needed via activation (socket, path, timer,
      D-Bus, udev, scripted systemctl call, ...).


      We also saw a few folders that were real old, as



      ls -ltr
      total 137452
      drwxr-xr-x 3 root root 33 Jun 13 2017 Tools
      drwx--x--x 3 root root 16 Oct 12 09:33 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-httpd.service-QZqGLA
      drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-rtkit-daemon.service-BTcGY1
      drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-vmtoolsd.service-mQ1SXc
      drwxr-xr-x 2 ambari ambari 18 Oct 12 12:02 hsperfdata_ambari
      drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-cups.service-PnKaq8
      drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-colord.service-DNn470
      -rwxr-xr-x 1 root root 83044 Nov 18 17:27 Spark_Thrift.log
      drwxr-xr-x 2 zookeeper hadoop 18 Nov 18 17:28 hsperfdata_zookeeper
      -rwxr-xr-x 1 root root 379 Nov 18 17:37 requests.txt
      -rwxr-xr-x 1 root root 137348 Nov 22 14:50 pp
      -rwxr-xr-x 1 root root 344 Nov 26 15:24 yy
      prwx--x--x 1 root root 0 Nov 29 21:26 hogsuspend
      -rwxr-xr-x 1 root root 1032 Dec 3 10:55 aa


      From my machine:



      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=1d


      The rules are:



      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 10d
      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









      share|improve this question















      On all my Red Hat Linux machines version 7.2 we saw that systemd-tmpfiles-clean.service is inactive:



      systemctl status systemd-tmpfiles-clean.service
      ● systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
      Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static; vendor preset: disabled)
      Active: inactive (dead) since Wed 2018-12-19 14:47:14 UTC; 12min ago
      Docs: man:tmpfiles.d(5)
      man:systemd-tmpfiles(8)
      Process: 34231 ExecStart=/usr/bin/systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
      Main PID: 34231 (code=exited, status=0/SUCCESS)

      Dec 19 14:47:14 master02.uridns.com systemd[1]: Starting Cleanup of Temporary Directories...
      Dec 19 14:47:14 master02.uridns.com systemd[1]: Started Cleanup of Temporary Directories.


      It is strange that we saw the files and folders under /tmp,
      and it seems that cleanup is performed every some time.



      I searched on crontab or cronjob, but I did not find other cleanup jobs.



      Am I missing something here?



      Is it possible that in spite of the service being inactive, the cleanup is performed every couple of weeks?



        systemctl enable  systemd-tmpfiles-clean.service

      The unit files have no [Install] section. They are not meant to be enabled
      using systemctl.
      Possible reasons for having this kind of units are:
      1) A unit may be statically enabled by being symlinked from another unit's
      .wants/ or .requires/ directory.
      2) A unit's purpose may be to act as a helper for some other unit which has
      a requirement dependency on it.
      3) A unit may be started when needed via activation (socket, path, timer,
      D-Bus, udev, scripted systemctl call, ...).


      We also saw a few folders that were real old, as



      ls -ltr
      total 137452
      drwxr-xr-x 3 root root 33 Jun 13 2017 Tools
      drwx--x--x 3 root root 16 Oct 12 09:33 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-httpd.service-QZqGLA
      drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-rtkit-daemon.service-BTcGY1
      drwx--x--x 3 root root 16 Oct 12 10:02 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-vmtoolsd.service-mQ1SXc
      drwxr-xr-x 2 ambari ambari 18 Oct 12 12:02 hsperfdata_ambari
      drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-cups.service-PnKaq8
      drwx--x--x 3 root root 16 Oct 12 12:17 systemd-private-74982d8a24254a1d8b8ec3b5c0d80a9b-colord.service-DNn470
      -rwxr-xr-x 1 root root 83044 Nov 18 17:27 Spark_Thrift.log
      drwxr-xr-x 2 zookeeper hadoop 18 Nov 18 17:28 hsperfdata_zookeeper
      -rwxr-xr-x 1 root root 379 Nov 18 17:37 requests.txt
      -rwxr-xr-x 1 root root 137348 Nov 22 14:50 pp
      -rwxr-xr-x 1 root root 344 Nov 26 15:24 yy
      prwx--x--x 1 root root 0 Nov 29 21:26 hogsuspend
      -rwxr-xr-x 1 root root 1032 Dec 3 10:55 aa


      From my machine:



      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=1d


      The rules are:



      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 10d
      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






      linux shell-script cron services tmp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 20 '18 at 6:59









      Peter Mortensen

      87758




      87758










      asked Dec 19 '18 at 15:04









      yael

      2,42812159




      2,42812159






















          2 Answers
          2






          active

          oldest

          votes


















          12














          You can ask systemd what a unit’s triggers are:



          systemctl show -p TriggeredBy systemd-tmpfiles-clean


          This will show that the systemd-tmpfiles-clean service is triggered by the systemd-tmpfiles-clean.timer timer. That is defined as



          #  SPDX-License-Identifier: LGPL-2.1+
          #
          # 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=1d


          Thus the service runs every day, and cleans directories up based on the tmpfiles.d configuration. See the associated man pages for details.






          share|improve this answer





















          • I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
            – yael
            Dec 19 '18 at 15:35










          • How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
            – Stephen Kitt
            Dec 19 '18 at 15:42










          • I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
            – yael
            Dec 19 '18 at 15:46










          • as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
            – yael
            Dec 19 '18 at 15:53










          • Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
            – Stephen Kitt
            Dec 19 '18 at 15:55



















          6














          systemd-tmpfiles-clean.service is initiated by systemd-tmpfiles-clean.timer. You can inspect the timers with systemctl list-timers.



          At least on Ubuntu 16.04, the systemd-tmpfiles-clean.timer is defined as



          # Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
          #
          # /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=1d


          Therefore, the timer will start systemd-tmpfiles-clean.service 15 minutes after boot, and every 24 hours afterwards.



          For more information, see systemd.timer(5), systemd.service(5) and systemd.unit(5).






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489940%2flinux-files-folders-cleanup-under-tmp%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            12














            You can ask systemd what a unit’s triggers are:



            systemctl show -p TriggeredBy systemd-tmpfiles-clean


            This will show that the systemd-tmpfiles-clean service is triggered by the systemd-tmpfiles-clean.timer timer. That is defined as



            #  SPDX-License-Identifier: LGPL-2.1+
            #
            # 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=1d


            Thus the service runs every day, and cleans directories up based on the tmpfiles.d configuration. See the associated man pages for details.






            share|improve this answer





















            • I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
              – yael
              Dec 19 '18 at 15:35










            • How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
              – Stephen Kitt
              Dec 19 '18 at 15:42










            • I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
              – yael
              Dec 19 '18 at 15:46










            • as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
              – yael
              Dec 19 '18 at 15:53










            • Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
              – Stephen Kitt
              Dec 19 '18 at 15:55
















            12














            You can ask systemd what a unit’s triggers are:



            systemctl show -p TriggeredBy systemd-tmpfiles-clean


            This will show that the systemd-tmpfiles-clean service is triggered by the systemd-tmpfiles-clean.timer timer. That is defined as



            #  SPDX-License-Identifier: LGPL-2.1+
            #
            # 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=1d


            Thus the service runs every day, and cleans directories up based on the tmpfiles.d configuration. See the associated man pages for details.






            share|improve this answer





















            • I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
              – yael
              Dec 19 '18 at 15:35










            • How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
              – Stephen Kitt
              Dec 19 '18 at 15:42










            • I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
              – yael
              Dec 19 '18 at 15:46










            • as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
              – yael
              Dec 19 '18 at 15:53










            • Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
              – Stephen Kitt
              Dec 19 '18 at 15:55














            12












            12








            12






            You can ask systemd what a unit’s triggers are:



            systemctl show -p TriggeredBy systemd-tmpfiles-clean


            This will show that the systemd-tmpfiles-clean service is triggered by the systemd-tmpfiles-clean.timer timer. That is defined as



            #  SPDX-License-Identifier: LGPL-2.1+
            #
            # 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=1d


            Thus the service runs every day, and cleans directories up based on the tmpfiles.d configuration. See the associated man pages for details.






            share|improve this answer












            You can ask systemd what a unit’s triggers are:



            systemctl show -p TriggeredBy systemd-tmpfiles-clean


            This will show that the systemd-tmpfiles-clean service is triggered by the systemd-tmpfiles-clean.timer timer. That is defined as



            #  SPDX-License-Identifier: LGPL-2.1+
            #
            # 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=1d


            Thus the service runs every day, and cleans directories up based on the tmpfiles.d configuration. See the associated man pages for details.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 19 '18 at 15:24









            Stephen Kitt

            164k24365444




            164k24365444












            • I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
              – yael
              Dec 19 '18 at 15:35










            • How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
              – Stephen Kitt
              Dec 19 '18 at 15:42










            • I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
              – yael
              Dec 19 '18 at 15:46










            • as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
              – yael
              Dec 19 '18 at 15:53










            • Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
              – Stephen Kitt
              Dec 19 '18 at 15:55


















            • I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
              – yael
              Dec 19 '18 at 15:35










            • How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
              – Stephen Kitt
              Dec 19 '18 at 15:42










            • I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
              – yael
              Dec 19 '18 at 15:46










            • as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
              – yael
              Dec 19 '18 at 15:53










            • Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
              – Stephen Kitt
              Dec 19 '18 at 15:55
















            I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
            – yael
            Dec 19 '18 at 15:35




            I update my question see the - "we can saw also few folder that real old as" , so if service is up evry 24Hours the how it can be that we have older files ?
            – yael
            Dec 19 '18 at 15:35












            How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
            – Stephen Kitt
            Dec 19 '18 at 15:42




            How often the service runs is one thing, what the deletion criteria are is another. See the last part of my answer.
            – Stephen Kitt
            Dec 19 '18 at 15:42












            I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
            – yael
            Dec 19 '18 at 15:46




            I post also the rules , as you can see some files and folder are not defined in the rules , and in spite this they are not deleted ?
            – yael
            Dec 19 '18 at 15:46












            as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
            – yael
            Dec 19 '18 at 15:53




            as you can see from the rules - /tmp 1777 root root 10d , its mean that files or folder that old then 10day will be deleted but for example - Tools is older folder or hsperfdata_ambari , so how it can be ?
            – yael
            Dec 19 '18 at 15:53












            Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
            – Stephen Kitt
            Dec 19 '18 at 15:55




            Have you read the documentation? Your ls output shows the last modification time, but the last access time is also taken into account, as is the status change time for files.
            – Stephen Kitt
            Dec 19 '18 at 15:55













            6














            systemd-tmpfiles-clean.service is initiated by systemd-tmpfiles-clean.timer. You can inspect the timers with systemctl list-timers.



            At least on Ubuntu 16.04, the systemd-tmpfiles-clean.timer is defined as



            # Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
            #
            # /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=1d


            Therefore, the timer will start systemd-tmpfiles-clean.service 15 minutes after boot, and every 24 hours afterwards.



            For more information, see systemd.timer(5), systemd.service(5) and systemd.unit(5).






            share|improve this answer


























              6














              systemd-tmpfiles-clean.service is initiated by systemd-tmpfiles-clean.timer. You can inspect the timers with systemctl list-timers.



              At least on Ubuntu 16.04, the systemd-tmpfiles-clean.timer is defined as



              # Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
              #
              # /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=1d


              Therefore, the timer will start systemd-tmpfiles-clean.service 15 minutes after boot, and every 24 hours afterwards.



              For more information, see systemd.timer(5), systemd.service(5) and systemd.unit(5).






              share|improve this answer
























                6












                6








                6






                systemd-tmpfiles-clean.service is initiated by systemd-tmpfiles-clean.timer. You can inspect the timers with systemctl list-timers.



                At least on Ubuntu 16.04, the systemd-tmpfiles-clean.timer is defined as



                # Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
                #
                # /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=1d


                Therefore, the timer will start systemd-tmpfiles-clean.service 15 minutes after boot, and every 24 hours afterwards.



                For more information, see systemd.timer(5), systemd.service(5) and systemd.unit(5).






                share|improve this answer












                systemd-tmpfiles-clean.service is initiated by systemd-tmpfiles-clean.timer. You can inspect the timers with systemctl list-timers.



                At least on Ubuntu 16.04, the systemd-tmpfiles-clean.timer is defined as



                # Use `systemctl cat systemd-tmpfiles-clean.timer` to get your corresponding file
                #
                # /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=1d


                Therefore, the timer will start systemd-tmpfiles-clean.service 15 minutes after boot, and every 24 hours afterwards.



                For more information, see systemd.timer(5), systemd.service(5) and systemd.unit(5).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 19 '18 at 15:24









                Zeta

                61837




                61837






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489940%2flinux-files-folders-cleanup-under-tmp%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Morgemoulin

                    Scott Moir

                    Souastre