[NTLUG:Discuss] OT: general UNIX question
Greg Edwards
greg at nas-inet.com
Thu Mar 10 11:43:30 CST 2005
Fred James wrote:
> The question still stands then, if anyone can offer a clue: Is there a
> simple way to count the number of times a given file is accessed.
> (operative word being simple)
>
> Thank you in advance for any help you may be able to offer.
> Regards
> Fred James
>
There is a daemon that comes with Mandrake, used by KDE and Gnome, called
FAM that can monitor file changes. I don't know if this will help since
you only get changes and not read counts.
In general, trapping an access to a file is not doable without getting
into the kernel and FS code.
You could setup a cron that runs every second where a program can be
executed to do a stat on the file(s) and output that to a file. The stat
can tell you when the file was accessed, but not how many times. If 15
accesses where made during the same second you'll only know about 1.
Good luck
--
Greg Edwards
New Age Software, Inc.
Custom software for an off the rack world
http://consult.nas-inet.com
More information about the Discuss
mailing list