/tmp/systemd-private-foo/tmp/ getting full
I've had this cron set for a long time:
0 1 * * * tmpwatch --mtime --all 168 /tmp
I recently discovered that there are 2 directories inside of /tmp, though, though aren't being deleted or emptied:
/tmp/systemd-private-1fe811633c7145c2a1603ebd168eb89d-ea-php56-php-fpm.service-pzgxY3/tmp/
/tmp/systemd-private-1fe811633c7145c2a1603ebd168eb89d-ea-php74-php-fpm.service-UOi0ZP/tmp/
The last 6 digits after fpm.service appear random; last year I made a note on this directory, and the last 6 digits were 2nrAOF.
I discovered this when my server reported that my inode usage was full, and it traced back to the ea-php74 version. I used tmpwatch to empty it about 24 hours ago, and it's already grown to 7.6G!
I confirmed that WHM > MultiPHP INI Editor > session.save_path = /tmp, so I'm not sure why it's creating these subdirectories.
I read in a previous thread that this can happen when someone logs in to cPanel and doesn't log out, but no one has access to those but me and I've logged in maybe 5 times in the last month :-/
Any suggestions on how to find what's causing them to fill up, prevent it from happening again, or to modify the cron to include them?
-
I did, that's where I found the tip to check session.save_path :-) Mine was set to /tmp, though, so his solution didn't help. The links to the other threads provided no insight, either. 0 -
I was finally able to get in to the large directory, and I see that the files are simply session files from my PHP scripts. I don't understand why they're in this subdirectory instead of just /tmp, but it's causing a real problem! I'm having to manually delete them twice a day! Knowing this to be the problem, though, I was able to research further and found this: 0 -
Trust, but verify. You can run the first portion of the command without the "rm" component to get a list of what will be removed: find /tmp/systemd-private*php-fpm.service* -name sess_* ! -mtime -1 0 -
@cPRex, how do I make that a cron? Minor update: I found this article: and restarted PHP-FPM. That had no impact, though, other than changing the name of the systemd-private directory :-/ 0 -
You wouldn't want to make the command without the "rm" portion a cron, as that won't be very helpful. That's just a "run this once to ensure you're not deleting anything you don't want" command. If you wanted to set this up as a cron, it would need to be done as the root user. 0 -
I understood that, haha :-) I'm asking, once I know it's working right, how do I set it as a cron with rm? The article wasn't clear. Would this be correct (using 22 to make it run at 11pm, per the article)? 0 22 * * * find /tmp/systemd-private*php-fpm.service* -name sess_* ! -mtime -1 -exec rm -f '{}' \; 0 -
That looks fine to me, although you may find you have to call the full path to /usr/bin/find inside cron. 0
Please sign in to leave a comment.
Comments
8 comments