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

Posted on

What controls the cleanup of the /tmp/systemd-private* directories? – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, centos, centos7, httpd, systemd.

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!

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.

Leave a Reply

Your email address will not be published.