Page 1 of 1
What files in user tmp directory?
Posted: Fri May 13, 2016 4:34 pm
by xguntis
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?
Re: What files in user tmp directory?
Posted: Sun May 15, 2016 9:49 am
by tjebbeke
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
Re: What files in user tmp directory?
Posted: Mon May 16, 2016 10:10 am
by xguntis
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/
Re: What files in user tmp directory?
Posted: Mon Dec 25, 2017 3:57 am
by plutocrat
skurudo's suggestion in this thread seems sensible
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
Re: What files in user tmp directory?
Posted: Mon Dec 25, 2017 7:04 pm
by mehargags
plutocrat wrote:skurudo's suggestion in this thread seems sensible
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
Re: What files in user tmp directory?
Posted: Tue Dec 26, 2017 1:56 am
by plutocrat
xguntis wrote:I am waiting already half an hour to finish execution of command rm tmp/*.
You could try
That works a lot quicker.