LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-03-2010, 05:17 PM   #1
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Rep: Reputation: 17
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..
 
Old 03-03-2010, 05:21 PM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 99
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.
 
Old 03-03-2010, 09:31 PM   #3
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
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
 
Old 03-04-2010, 09:51 PM   #4
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
I'm sorry, but is there any other thoughts?

Regards..
 
Old 03-05-2010, 12:44 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
Look at the find cmd with the -atime option
 
Old 03-05-2010, 10:50 AM   #6
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
@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.
 
Old 03-07-2010, 05:02 PM   #7
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
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..
 
Old 03-07-2010, 08:10 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
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
 
1 members found this post helpful.
Old 03-10-2010, 10:06 PM   #9
WhisperiN
Member
 
Registered: Jun 2009
Location: Middle East
Distribution: Slackware 13.1, CentOS 5.5
Posts: 137

Original Poster
Rep: Reputation: 17
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..
 
  


Reply

Tags
access



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I check who has accessed a file recently? davidstvz Linux - Security 4 06-29-2009 11:20 AM
Can linux+apache cater to pages that are accessed by mobile devices like cellphones? chickenjoy Linux - Server 4 05-18-2007 03:13 AM
apache server cannot be accessed from other computers in LAN mohtasham1983 Linux - Server 9 04-03-2007 02:56 PM
Is there any way to tell which user last accessed a file? sixerjman Programming 2 10-19-2006 01:28 AM
file created/accessed dates plainkeyman Linux - General 4 10-27-2005 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration