4

It doesn't seem like the systemd-tmpfiles service cleans up these folders because I have files in /tmp/systemd-private-*-httpd.service-*/tmp/ that are 27ish days old (the last time httpd was restarted). If I'm reading the /usr/lib/tmpfiles.d/tmp.conf file correctly then the inner tmp dir should be getting cleaned out every 10 days because of v /tmp 1777 root root 10d and X /tmp/systemd-private-%b-*/tmp right? I believe I read in the man that X is don't delete the dir but delete everything inside of it.
My systemd-tmpfiles-clean.timer service is set to OnBootSec=15min and OnUnitActiveSec=1d

So am I understanding this correctly, or is there another service that's in charge of cleaning that dir, or.. is something just broken? TIA!

Exlipse
  • 41
  • 1
  • 2

1 Answers1

0

Nothing is broken.

systemd should not disturb a temporary directory that is still in use by a service, as yours is. Once it is no longer in use, then it is eligible to be cleaned up.

The x/X means to ignore the directory, according to the man page:

     #Type Path                                     Mode User Group Age          Argument
     x     /path-or-glob/to/ignore                  -    -    -     -            -
     X     /path-or-glob/to/ignore/recursively      -    -    -     -            -

When the service stops, systemd will delete the entire systemd-private temporary directory at that time.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Thanks for the clarification. That was my initial understanding of the X type, but further down the man there's this line in the explanation `Unlike x, this parameter will not exclude the content if path is a directory, but only directory itself.` which seems to say that since /tmp/sysd.../tmp is a dir that it's contents would not be excluded. – Exlipse Feb 16 '21 at 17:29
  • @Exlipse That's a good point. I'm not sure if the man page is wrong there or I am. I'll dig into a bit further. – Michael Hampton Feb 16 '21 at 17:36