how to find which program that update a specific file | Unix Linux Forums | AIX

  Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

how to find which program that update a specific file

AIX


Tags
aix, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-03-2012
cstsang cstsang is offline
Registered User
 
Join Date: May 2012
Last Activity: 7 July 2014, 5:40 AM EDT
Location: Hong Kong
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
how to find which program that update a specific file

Hello

Would you tell me how to find which program that update a specific file?
I am implementing migration project.
My machines OS are AIX.
It is because lack of documentation, some program cannot working properly on new machine.
We found the root cause of this problem is that some data files are not update properly,so I want to install program on old machine to find out which program(s) would update a specific file.

ps: I am just a normal user (not root) in both new and old machine.
Sponsored Links
    #2  
Old 10-03-2012
gts1999 gts1999 is offline
Registered User
 
Join Date: Aug 2012
Last Activity: 12 September 2013, 6:59 AM EDT
Posts: 24
Thanks: 1
Thanked 2 Times in 2 Posts
If you need to know what program is actively using a file, try installing lsof (or get your Admins to do this).

If you want to see who modified (past tense) a file, you will need some sort of accounting or auditing enabled.
This will be trickier than you think I imagine.
Sponsored Links
    #3  
Old 10-03-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 29 July 2014, 11:17 AM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,128
Thanks: 44
Thanked 771 Times in 607 Posts
gts is right - auditing a system can be tricky. Still, if you have only one (or very few) file(s) to monitor you can probably set up a loop with "lsof" and a log file, which might "catch" the offending process in the act. In any way, finding out which process modified a file in the past is impossible. You can only wait for the process to modify it again and then "catch" it while it does so.

I hope this helps.

bakunin
    #4  
Old 10-04-2012
funksen funksen is offline Forum Advisor  
Registered User
 
Join Date: Nov 2006
Last Activity: 30 April 2014, 10:11 AM EDT
Location: Austria/Vienna
Posts: 675
Thanks: 21
Thanked 31 Times in 30 Posts
with audit, a sample configuration I have done a few months ago
the file to audit is /db2/SID/sqllib/db2systm in this case


Code:
hostname:/etc/security/audit--# cat objects
/db2/SID/sqllib/db2systm:
       r = "FILE_Open"
       w = "FILE_Open"



nohup  /usr/sbin/auditstream | nohup auditpr -v > /fs/audit/stream.out &

audit enable
audit start

the events are logged in /fs/audit/stream.out



you need to be root to update these files
Sponsored Links
    #5  
Old 10-05-2012
cstsang cstsang is offline
Registered User
 
Join Date: May 2012
Last Activity: 7 July 2014, 5:40 AM EDT
Location: Hong Kong
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
I found lsof command on my machine it solve my problem.
thank you very much
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
find specific file names and execute a command depending on file's name armando110 Shell Programming and Scripting 3 02-09-2012 08:34 PM
find function name in a program file Parthiban Shell Programming and Scripting 8 06-26-2010 09:25 AM
Update a specific line in a file while reading sequentially bharath.gct Shell Programming and Scripting 6 05-14-2010 02:22 AM
find for specific content in file in the directory and list only file names madhu_Jagarapu AIX 2 12-23-2008 01:13 AM
Update specific lines in a file aukequist Shell Programming and Scripting 3 11-15-2005 12:52 PM



All times are GMT -4. The time now is 12:49 PM.