Monitor files being copied/accessed | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Monitor files being copied/accessed

UNIX for Advanced & Expert Users


Tags
access, files, monitor

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-17-2010
prostiiinet prostiiinet is offline
Registered User
 
Join Date: Mar 2010
Last Activity: 3 May 2010, 3:42 PM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Monitor files being copied/accessed

Hello,

Is there a way (without 3rd party software) to know if a file has been accessed and/or copied ?

I'm interested in any solution : doing command line instructions , running background scripts etc...

I apologize if I posted this in the wrong forum.

Thank you!
Sponsored Links
    #2  
Old 03-17-2010
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 22 October 2014, 11:15 AM EDT
Location: NM
Posts: 10,247
Thanks: 281
Thanked 803 Times in 747 Posts
IF you are linux read up on inotify in C or maybe inotifywait.
If it is a different kernel we need specifics: OS & version
Sponsored Links
    #3  
Old 03-17-2010
prostiiinet prostiiinet is offline
Registered User
 
Join Date: Mar 2010
Last Activity: 3 May 2010, 3:42 PM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry about that.

Mac OS X 10.5.

Thank you about the information concerning inotify (i was interested in a linux solution too, but I prefer a Mac one, if possible).

Thank you
    #4  
Old 03-17-2010
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 22 October 2014, 11:15 AM EDT
Location: NM
Posts: 10,247
Thanks: 281
Thanked 803 Times in 747 Posts
Apple is not like linux - there is no API. Try
Watcher
Sponsored Links
    #5  
Old 03-17-2010
prostiiinet prostiiinet is offline
Registered User
 
Join Date: Mar 2010
Last Activity: 3 May 2010, 3:42 PM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
I was just reading about FSevents (google pointed me there after you told about inotify).

Thank you for your help. Maybe watcher will allow me to learn how to manipulate FSevents in order to do what i want it to do.
Sponsored Links
    #6  
Old 03-18-2010
glev2005 glev2005 is offline
Registered User
 
Join Date: Oct 2008
Last Activity: 19 July 2014, 10:56 PM EDT
Posts: 276
Thanks: 20
Thanked 6 Times in 6 Posts

Code:
sudo fs_usage -e -w -f filesys |grep -i write |grep -v grep

--this shows you what is being written to, instead of grep -i write, you could try cache_hit or just leave out the grep stuff and filter later, this is the OSX command you want I believe. It is a spin off of the Solaris dtrace utility which reads real time system calls and what not. You will learn what to filter by looking at the unfiltered output first, if you want to know what a specific process is doing, writing, etc, then grep for it, you should see the process on the left and the files being touched on the right when it's writing to a plist which is what I assume you are trying to figure out.
Sponsored Links
    #7  
Old 03-18-2010
prostiiinet prostiiinet is offline
Registered User
 
Join Date: Mar 2010
Last Activity: 3 May 2010, 3:42 PM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, that's what I need. the -f network is very useful too!
Thank you!

P.S. I am new on this forum (you probably know this already ). Do I have to do something to close this thread ?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Number of files accessed this week RAFC_99 UNIX for Dummies Questions & Answers 5 11-22-2009 02:58 PM
Ignoring already copied files nvandyke UNIX for Dummies Questions & Answers 0 04-30-2008 04:39 PM
Searching files by last accessed time Trellot UNIX for Dummies Questions & Answers 4 11-23-2007 10:28 PM
Find files not accessed on a remote server and delete - Help! bond_bhai Shell Programming and Scripting 1 07-17-2007 05:59 AM
monitoring files copied onto hard disk abhi_abhijith Programming 2 02-15-2006 09:51 AM



All times are GMT -4. The time now is 11:44 PM.