Deleting Temp files using tmpwatch

I have a CPanel server that using PHP 5.x and run's eaccelerator. The temp files from eaccelerator are filling up my temp disk too quickly and I'd like to run a cron job using tmpwatch to delete the files but the command I'm using to test the delete I'm not getting to work correctly. Can someone help me w/ this?
Here's my command:
tmpwatch -f  24 /usr/tmp/eaccelerator/1/1
It runs w/ no error but does not delete the files over 24hrs. old.

JohnP
pcshostAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SuperdaveCommented:
What is in the tmpwatch script?
0
ajay_mhasalCommented:
Hi,

I think the problem is of permissions and you need to run this command either from the owner of those files or from root. Following command should work fine to delete the files which are not accessed from last 24 hrs. Also if you wish to check why your current command is not deleting the files then use "--verbose" option with your command i.e.

tmpwatch --verbose  24  /usr/tmp/eaccelerator/1/1


I hope this will work!
0
pcshostAuthor Commented:
I don't have a tmpwatch script. I'm just running the command from the command prompt as root and no, oddly enough it doesn't work. I can run rm *.* and delete the files fine and just skip the current one's but the tmpwatch doesn't work plus it doesn't with the verbose switch on, list anything it does.

I'm also thinking that I did delete the files from the eaccelerator/1/1 folder yesterday but I'm seeing there were new one's today with old dates so I have to verify that I'm not hallucinating and see if that has something to do with it. I'll also test this command on another part of the server.  Thx.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

pcshostAuthor Commented:
addendum:
tmpwatch --verbose  24  /usr/tmp/eaccelerator/1/1  Didn't work BUT
tmpwatch --verbose  0  /usr/tmp/eaccelerator/1/1 did remove the files so the argument 24 is the issue. The default is u: --atime but is there some other argument's I need to use to delete files after 24 hours?

0
ajay_mhasalCommented:
Hi,

By default tmpwatch deletes files which are not accessed in last 24 hrs. i.e. by referring the atime of the file (Note that the periodic updatedb file system scans keep the atime of directories recent.) You can check the access,modify and creation time of file using stat command eg.

stat <file name>
0
pcshostAuthor Commented:
So all I need to do is technically run the tmpwatch command at the eaccelerator root and it'll delete anything over 24 hours?
0
ajay_mhasalCommented:
HI,

Yes but only if the files are not accessed within last 24 hrs. and somehow the files are accessed within 24 hrs (By programs like updatedb) and if you still wish delete those then try following command.

tmpwatch -ctime 24 /usr/tmp/eaccelerator/1/1

In your case when the file are getting deleted by using 0 instead of 24 means some program on your system has accessing those files within 24 hrs.

Also note that if you use 24 as a time parameter then tmpwatch will calculate 24 hrs. from the time when you actually runs the command tmpwatch and not the last day.
0
pcshostAuthor Commented:
Oh that last part makes sense. So I'll run the tmpwatch command and then 24 hours from now I should see the files disappear? I'll do that.

Thx
0
pcshostAuthor Commented:
The tmpwatch wasn't working. I did find this command which did delete files that we're over 24hrs not accessed in the tmp/eaccelerator directory:

find /tmp/eaccelerator ! -mtime -1 -type f -exec rm {} \;

John
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.