bergman on 21 Nov 2011 09:56:07 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] How to Find Most Used Files


In the message dated: Mon, 21 Nov 2011 15:48:26 +0100,
The pithy ruminations from sean finney on 
<Re: [PLUG] How to Find Most Used Files> were:
=> On Sun, Nov 20, 2011 at 03:20:14PM -0500, Rich Freeman wrote:
=> > I could envision a program aggregating from lsof or something like
=> > that, or using a file-alteration-monitor or direct accounting calls to
=> > the kernel.  That wouldn't require quite as many updates since you
=> > could flush the log once an hour or whatever.  I have no idea if such
=> > a thing already exists though.
=> 
=> Assuming you're on a linux system (i.e. not BSD/Slowlaris/AIX), you can
=> use either inotify or stap for this purpose.  For example, if you have

	[SNIP!]

=> 
=> inotify isn't too much more complicated, and there are python bindings
=> out there.  and inotify has the advantage of not requiring those debug
=> symbols, but I didn't have an example laying around for that one :)
=> 
 	[SNIP!]

I use inotify, with incrond, to implement a 'dropbox' arrangement for our lab.
Users can upload files to a specified directory (watched by incrond), and the
inode change on that directory triggers a script that chown's the new files to
a project owner.

Sample /etc/incrond/dropbox config:

	/projects/dropbox/ IN_ALL_EVENTS,IN_NO_LOOP /usr/local/sbin/dropbox_chown $@$#

Mark

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug