(Dec 29) New version 0.9.8-18 has been released. More you can find here

What files in user tmp directory?

General questions about VestaCP
Forum rules
Before creating a new topic or reply on the forum you should fill out additional fields "Os" and "Web" in your profile section.
In case of violation, the topic can be closed or response from the support will not be received.
xguntis
Posts: 23
Joined: Sat Mar 12, 2016 12:42 pm

What files in user tmp directory?

Postby xguntis » Fri May 13, 2016 4:34 pm

Can anybody tell what files are stored in /home/{user}/tmp/ directory? Is it safe to delete them? For all, except one of user this directory is empty. And this one user has 1.7 million files there and i think the number of files is growing very fast. I am trying to delete the files and it takes ages. I am waiting already half an hour to finish execution of command rm tmp/*.

What could be the reason of so many files in this directory?

tjebbeke
Collaborator
Posts: 759
Joined: Mon May 11, 2015 8:43 am
Contact:

Os: CentOS 7x
Web: apache + nginx

Re: What files in user tmp directory?

Postby tjebbeke » Sun May 15, 2016 9:49 am

If you are using the hosting template the dirs are used for sessions and as tmp upload dir.


https://github.com/serghey-rodin/vesta/ ... osting.tpl

Code: Select all

php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp

xguntis
Posts: 23
Joined: Sat Mar 12, 2016 12:42 pm

Re: What files in user tmp directory?

Postby xguntis » Mon May 16, 2016 10:10 am

thanks for reply

if they are used for sessions - should the quantity of files only increase or also decrease? I can see it is always increasing. If so, they soon will consume all the inodes.

=== edit ===

After some googling i concluded that garbage collector for some reason was not working as expected. It just could not be that there are millions of unexpired sessions on a not so busy site. I deleted all the files manually and will keep an eye on that dir if it still is only growing.
re:
https://www.dev-metal.com/how-the-php-s ... lly-works/

plutocrat
Posts: 89
Joined: Fri Jan 27, 2017 9:16 am

Re: What files in user tmp directory?

Postby plutocrat » Mon Dec 25, 2017 3:57 am

skurudo's suggestion in this thread seems sensible
https://forum.vestacp.com/viewtopic.php?t=13209

.. put this command in a weekly cronjob to keep them at bay

Code: Select all

find /home/*/tmp -type f -name 'sess_*' -ctime +5 -delete

mehargags
Moderators
Posts: 903
Joined: Sat Sep 06, 2014 9:58 pm
Contact:

Re: What files in user tmp directory?

Postby mehargags » Mon Dec 25, 2017 7:04 pm

plutocrat wrote:skurudo's suggestion in this thread seems sensible
https://forum.vestacp.com/viewtopic.php?t=13209

.. put this command in a weekly cronjob to keep them at bay

Code: Select all

find /home/*/tmp -type f -name 'sess_*' -ctime +5 -delete


Yes Skurudo's suggestion works good. I usually setup a DAILY cron for root to clean all ../tmp sess* files older than 2 days. This helps to keep it clean

plutocrat
Posts: 89
Joined: Fri Jan 27, 2017 9:16 am

Re: What files in user tmp directory?

Postby plutocrat » Tue Dec 26, 2017 1:56 am

xguntis wrote:I am waiting already half an hour to finish execution of command rm tmp/*.


You could try

Code: Select all

ls -1 -f | xargs rm

That works a lot quicker.


Return to “General Discussion”



Who is online

Users browsing this forum: No registered users and 3 guests

cron