LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Is there a way to know the last time Apache accessed a file? (https://www.linuxquestions.org/questions/linux-server-73/is-there-a-way-to-know-the-last-time-apache-accessed-a-file-792994/)

WhisperiN 03-03-2010 05:17 PM

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.. :)

carltm 03-03-2010 05:21 PM

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.

WhisperiN 03-03-2010 09:31 PM

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 :)

WhisperiN 03-04-2010 09:51 PM

I'm sorry, but is there any other thoughts?

Regards..

chrism01 03-05-2010 12:44 AM

Look at the find cmd with the -atime option

WhisperiN 03-05-2010 10:50 AM

@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.

WhisperiN 03-07-2010 05:02 PM

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.. :)

chrism01 03-07-2010 08:10 PM

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

WhisperiN 03-10-2010 10:06 PM

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
Could you please, let me know what way would this help me?

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.