What controls the cleanup of the /tmp/systemd-private* directories?

Exlipse asked:

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!

My answer:


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.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.