Is there a way to know the last time Apache accessed a file?
Hello Fellows,
How you doing? I have a dozen huge folders loaded with files (images, and so..).. I was wondering if Apache marks the files it accesses.. Thus, in case I want to delete files which haven't been accessed or surfed for a long time.. is that possible? Is there a way to achieve such a mission? Cheers All.. :) |
Yes, just look in your apache log files. They might be in
/var/log/httpd or /var/log/apache2. It's the access logs that let you know what pages people have tried to open. |
Hello buddy,
Yes, I know about the Apache access logs.. But they will give me hints about the files that were accessed.. What I'm looking for, are the files that haven't been accessed in a long time.. I'm talking here about thousands of files.. not tins.. What I need to do, is to purge the un-surfed-any-more files. I guess, access logs will not help in my case, unless if there is some way to do that. Dose a file-last-access-history usually get effected by Apache reading them? Regards :) |
I'm sorry, but is there any other thoughts?
Regards.. |
Look at the find cmd with the -atime option
|
@chrism01
Great hint.. I'll try to find something about it, I did try with the ls -u, ls -t But, seems like Apache doesn't write or modify the file access time.. I'm not sure. |
Back..
Well, that solution, seems to be not working with Apache accessing those files.. Any other options, or if you don't mind giving me the exact 'find' command to try? just in case if I was hitting the wrong command. Thanks.. :) |
Any time a prog accesses a file (reads it), the filesystem updates the file's atime. If the file is modified, the filesystem updates the mtime... This is any prog, not just Apache.
It is possible to mount an FS with -noatime to give a slight boost in performance but that's unusual. Check the /etc/fstab file entry. http://johnmeister.com/CS/UNIX/FIND/find-usage.html |
Chrism01, Thanks a lot for your info..
In fact, I did view the /etc/fstab, but I couldn't realize it. Code:
none /dev/pts devpts rw 0 0 Also, for the (find) part.. I did several tries.. I could find files, with thier access time, etc.. But, when I let Apache to surf there files, it didn't seem that it changes any thing..!! How would I know that the system is not -noatime enabled? Much Deep Regards.. :) |
All times are GMT -5. The time now is 10:41 AM. |