_TMP Directory "Many .avi Files"

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Hi Guys

I do not know why the _TMP directory every day has many .AVI files ?

Some body has the same issue?
Why only .AVI files?

This happen after install the Media Player Plugin, time before was worging fine. Now i have disable the Media Player Plugin and still the same issue :(

Some body has been in the same situation?

Please help me!
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Files being uploaded will be stored in the _tmp folder. When the script gets all parts of the upload it will move the file to the correct path. However, if the user cancels the upload or if the script crashes the file will remain in the _tmp folder forever.

You can setup a cron command to delete any file older than 2 days from the _tmp and _delete folders.
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Thanks for your answer! helps good

So, Adam does the script include this Cronjob to delete those garbage files?

Regards
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Hi,

Yes, there is a function in /core/includes/uploader.class.php named cleanLeftOverChunks(), it should clear anything older than 3 days in the _tmp folder.

It's called via handleFileUpload() in the same file, although the call is only triggered on chunked uploads (files larger than 100MB).

@enricodias4654 if you're saying this isn't happening, i.e. files older than 3 days remain, something in cleanLeftOverChunks() may not be picking them up. Is it on a 'direct' server? There's a double check in the code with _CONFIG_FILE_STORAGE_PATH which may be different on a file server (and should probably be allowed for in the code).

This function doesn't exist in a cron at the moment though.

@regioserver from memory, didn't these files appear every 4 minutes? There was a consistency about them that suggested some automatic process (bot) might be causing them. If you have a screenshot of the times, ordered by time, that may be helpful here.

Thanks,
Adam.
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
adam said:
@enricodias4654 if you're saying this isn't happening, i.e. files older than 3 days remain, something in cleanLeftOverChunks() may not be picking them up. Is it on a 'direct' server? There's a double check in the code with _CONFIG_FILE_STORAGE_PATH which may be different on a file server (and should probably be allowed for in the code).
Yes, is on direct servers. I didn't even noticed the function cleanLeftOverChunks, but it still leaves files in the _tmp folder. I just checked the function here and it's just tries to remove files from the _tmp folder and not from the _deleted folder.

I think it doesn't work because it's using filemtime to check the file modification time. I had similar issue when I was checking the file creation time in the cronjob, some files was still being left there and using "ctime" solved it. Maybe your function would work using filectime instead of filemtime. Also, results of those functions are cached so you may want to use the function clearstatcache just to be sure.

In some Unix filesystems a file is considered changed when its inode data is changed; that is, when the permissions, owner, group, or other metadata from the inode is updated. filectime will check the inode.

Anyway, it's simpler to just use a cronjob.

regioserver said:
Thanks for your answer! helps good

So, Adam does the script include this Cronjob to delete those garbage files?

Regards
Those are the cronjobs that I use:

find httpdocs/files/_tmp/* -type f -ctime +3 -delete
find httpdocs/files/_deleted/* -type f -ctime +3 -delete

I run them 1x every night.
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Those are the cronjobs that I use:

find httpdocs/files/_tmp/* -type f -ctime +3 -delete
find httpdocs/files/_deleted/* -type f -ctime +3 -delete

I run them 1x every night.


Those cronjobs looks for Windows, or also works for Linux ?
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
regioserver said:
Those cronjobs looks for Windows, or also works for Linux ?
Those commands are not even remotely close to anything on windows. Windows doesn't even have "cronjobs". It uses its own task scheduler.
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
So the correct way to use in cronjob in Cpanel could be:

find home/domain/public_html/files/_tmp/* -type f -ctime +3 -delete

Please correct me if iam wrong :)
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
regioserver said:
So the correct way to use in cronjob in Cpanel could be:

find home/domain/public_html/files/_tmp/* -type f -ctime +3 -delete

Please correct me if iam wrong :)
You can use relative path, public_html/files/_tmp/* or absolute path, /home/CPANEL_USERNAME/public_html/files/_tmp/*

The first / is important in the absolute path.
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Hi

I had created a crontab with the next line: "home/domain/public_html/files/_tmp/* -type f -ctime +3 -delete"

But does not works, does not delete the files :)
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
regioserver said:
Hi

I had created a crontab with the next line: "home/domain/public_html/files/_tmp/* -type f -ctime +3 -delete"

But does not works, does not delete the files :)
You just ignored my last post saying that the first / is important in absolute paths.

Also, if you don't know enough to add and debug a simple cronjob, you should hire someone to take care of your server.
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Sorry I wrote wrong, iam using / at the beginning as you said:(
But it does not works

Let me try to find something in somewhere and then put here to help another users like me.

Regards
 

regioserver

New Member
YetiShare User
Wurlie User
Oct 18, 2014
36
0
0
Mexico
Ok guys, done!!

Iam using this command each 1 hour:

find /home/domain/public_html/files/_tmp/*.avi -mtime -1 -exec rm -f {} \;

Works perfek, now iam not worry about this garbage files

Regards