Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

var/tmp/systemd- session file removal

Discussion in 'General Discussion' started by sfakman, Jun 28, 2018.

  1. sfakman

    sfakman Registered

    Joined:
    Jun 28, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Website Owner
    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.
     
  2. sfakman

    sfakman Registered

    Joined:
    Jun 28, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Website Owner
    I think I've solved this. Just in case anyone else has the same issue...

    My php.ini file had no location specified in session.save_path so I added one via the cPanel MultiPHP INI Editor then created a new cron job via cPanel to empty the folder every 3 hours. It looks like the inodes increase has moved now to the location of my web root which has much more space. Coupled with the cron job I'm hoping this will be sufficient.
     
  3. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    2,721
    Likes Received:
    186
    Trophy Points:
    143
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice