I had a VPS server and moved to dedicated a few weeks back, both with cPanel/WHM. I’m a total newbie to Linux and I’ve been having quite few problems since migrating my site over to a dedicated server.
My website is fairly session heavy and I’m seeing the following directory var/tmp/systemd-<random-path-here>/tmp fill up with a lot of session files. Most of the session files are blank. However, some do contain data.
After looking around here I saw there were references to tmpwatch to address the problem. tmpwatch is running but it doesn’t seem to be solving my issue.
I’ve had a couple of “no available inode” email alerts after about 130,000 session files have been created followed by my website eventually going offline. Generally a reboot solves it.
After a reboot, I understand the var/tmp directory is emptied and from what I can see a number of new var/tmp/systemd-<random-path-here>/tmp directories are created after a reboot. The session files appear in one of the new random directories.
To prevent the directory filling up I setup a cron job to empty var/tmp/systemd-<random-path-here>/tmp every three hours which ties in with my current session expiry length. However, it looks like the directory path changes every 24 hours (?). At the moment I’m changing the cron job path every day - this is obviously not sustainable.
I’ve been doing lots of research and reading up and it’s not clear to me what the solution is. I guess I’m looking for some reassurance and advice.
Is setting up a cron job the right thing to do to handle this situation (other than reviewing my session management in my code)?
How would I handle dynamically changing folder names with a cron? Would something like rm -rf var/tmp/systemd-*/tmp/sess_* work? Note the * - I’m not sure if this the right way to do wildcard dynamic folder names. Also, there are other systemd-<randomstringhere>/tmp folders but they contain nothing so if the cron job I mention was setup, they would be removed too - would removing these every 3 hours be a problem?
And lastly, the fact that the folder name appears to be changing every 24 hours - is that tmpwatch working after all?
Sorry, as you can tell - my knowledge is rather limited. Any help/suggestions would be appreciated.
My website is fairly session heavy and I’m seeing the following directory var/tmp/systemd-<random-path-here>/tmp fill up with a lot of session files. Most of the session files are blank. However, some do contain data.
After looking around here I saw there were references to tmpwatch to address the problem. tmpwatch is running but it doesn’t seem to be solving my issue.
I’ve had a couple of “no available inode” email alerts after about 130,000 session files have been created followed by my website eventually going offline. Generally a reboot solves it.
After a reboot, I understand the var/tmp directory is emptied and from what I can see a number of new var/tmp/systemd-<random-path-here>/tmp directories are created after a reboot. The session files appear in one of the new random directories.
To prevent the directory filling up I setup a cron job to empty var/tmp/systemd-<random-path-here>/tmp every three hours which ties in with my current session expiry length. However, it looks like the directory path changes every 24 hours (?). At the moment I’m changing the cron job path every day - this is obviously not sustainable.
I’ve been doing lots of research and reading up and it’s not clear to me what the solution is. I guess I’m looking for some reassurance and advice.
Is setting up a cron job the right thing to do to handle this situation (other than reviewing my session management in my code)?
How would I handle dynamically changing folder names with a cron? Would something like rm -rf var/tmp/systemd-*/tmp/sess_* work? Note the * - I’m not sure if this the right way to do wildcard dynamic folder names. Also, there are other systemd-<randomstringhere>/tmp folders but they contain nothing so if the cron job I mention was setup, they would be removed too - would removing these every 3 hours be a problem?
And lastly, the fact that the folder name appears to be changing every 24 hours - is that tmpwatch working after all?
Sorry, as you can tell - my knowledge is rather limited. Any help/suggestions would be appreciated.