Which process has created a file ?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Which process has created a file ?
# 1  
Old 02-23-2012
MySQL Which process has created a file ?

Hi All,

We have a multi-threaded application.

During the course of action, each process creates some files. Is there any way to know which process has created a particular file ?


Ex:
Suppose we have 3 process running A, B and C in the application and some files FILE1 FILE2 FILE3 and FILE4 are generated when the application is ran, is there any way to map the peocess(es) [A, B, C] to the files [FILE1 FILE2 FILE3 FILE4] created by them ?

Any help would be appreciable.

Thanks & Regards,
14341
# 2  
Old 02-23-2012
Quote:
Originally Posted by 14341
Hi All,

We have a multi-threaded application.

During the course of action, each process creates some files.
Which? Is it multiple threaded, or multi-processing? Or perhaps both?
Quote:
Is there any way to know which process has created a particular file ?
This only works for processes, not threads, but you could run each instance under a different user id. The resulting files would belong to the corresponding user.

---------- Post updated at 09:40 AM ---------- Previous update was at 09:37 AM ----------

Otherwise, I would have the threads use better names for the files... Instead of file1 file2 file3 file4, file-<threadid1>, file-<threadid2>, file-<threadid3>, file-<threadid4>. The name itself will tell you what you need to know.
# 3  
Old 02-23-2012
On what system are you running this application?
# 4  
Old 02-23-2012
Hi Guys,

Thank you for your suggestions.

Corona688,

Yes the application is both multi-processed and multi-threaded one.

The application comprises of both C++ code, Java code and some 3rd party integration as well.

No one has (I think no one will ever have) a control on the code flow of the overall application since it is very huge (only source code is around 600 MB without compilation) and has many branches.

This app is an acquired product and we are short in terms of the documentation

I was just trying to figure out if there is any way (without modifying the entire source-code) to find out the correlation between the files-created Vs process.

Like from inode structure or something similar.


Bartus11,

The application is being run on both SOLARIS and RHEL.


Please pour in if you have any suggestion(s).

Thanks & Regards,
14341
# 5  
Old 02-23-2012
On Solaris (assuming you are running version 10 or higher) you can use DTraceToolkit (DTrace Tools). Particularly the "rwsnoop" tool with "-n app_name" option.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script replied multiple process for file has successfully created

Hi All, I have written the following code do FILE_NO=$(echo $LINE|awk -F"|" '{print $1}'|tr "'" '+'|sed 's/\(.*\)\(++\)\(.*\)\(++\)/\3/') INST_NO=$(echo $LINE|awk -F"|" '{print $2}'|tr "'" '+'|sed 's/\(.*\)\(++\)\(.*\)\(++\)/\3/') if ] then ... (3 Replies)
Discussion started by: yogendra.barode
3 Replies

2. Shell Programming and Scripting

File not getting created

hi, i have a script wrriten where there is a temporary files getting created: echo "From:" ${usrname}@apps.mc.xerox.com>mail_txt it was working from a long time but now there is a error creating while creating this temporary file. here is the error log for this:... (15 Replies)
Discussion started by: lovelysethii
15 Replies

3. Shell Programming and Scripting

Changing file permissions of a file created by another user

Hi, I have used expdp for datapump. The .dmp file is created by the "oracle" user. my requirement is to make a zipped file of this .dmp file. What i am trying to do is change the permissions of this .dmp file from 0640 to 0644 and then do a gzip and zip it. Is there any way i can change... (3 Replies)
Discussion started by: qwertyu
3 Replies

4. UNIX for Dummies Questions & Answers

Who created a file?

Hi!Can somebody tell me what command can I use to find who created a file,please? (6 Replies)
Discussion started by: teotrask
6 Replies

5. Infrastructure Monitoring

JFFNMS: RRD files for imterface id 2190 has not been created by the Poller Process yet

hi, When we tried to add host in jffnms and marked all interfaces, it worked well with newly added hosts for linux. However if its solaris, we cannot see CPU interface. The error in the graph is RRD files for interface id 2190 has not been created by the Poller Process yet. Pls advise. ... (0 Replies)
Discussion started by: lhareigh890
0 Replies

6. Homework & Coursework Questions

how to delete core file (file created due to apps crashed)

1. The problem statement, all variables and given/known data: When looking for corefiles, include any file with core in its name. (Some UNIX/Linux systems add the PID of the process that created the core to reduce the chances of overwriting an already existing core file that might be needed. The... (6 Replies)
Discussion started by: s3270226
6 Replies

7. UNIX for Dummies Questions & Answers

How to know when a new file is created?

Hi All, How to we get to know when say a new log file is created on an Unix box. I need to trigger a process(say a script) when the new log file is created. But i need to know by some means or generate a trigger when a new file is created???? Something like when we receive a new mail we... (1 Reply)
Discussion started by: aixjadoo
1 Replies

8. Shell Programming and Scripting

How to empty a file(already created)

What is the command to empty an already existing file. please provide me.i used Touch cmd to empty the file.but it changing the time only. (4 Replies)
Discussion started by: laknar
4 Replies

9. Shell Programming and Scripting

Need to process files created an hour ago

Hello all, I would like to ask for an advice on how to deal with the following scenario. Every now and then, our ERP system creates an interface text file with the following file format - XORD????.DLD where ???? is a sequence number. We can have 1 or more XORD files created in an hour. ... (9 Replies)
Discussion started by: negixx
9 Replies

10. Programming

Reference Variables To A Child Process Created With Fork

Hi! IN THE FOLLOWING PROGRAM THE VALUE OF j REMAINS UNCHANGED . WHY ? IF I WANT A VARIABLE VALUE TO CHANGE LIKE THIS , IS THERE ANY WAY TO DO IT ? Or do we have to use shared memory variables? main() { int return_pid, i, total; int j=1; total = TOTALRECS+1; for... (2 Replies)
Discussion started by: AJAY BHATIA
2 Replies
Login or Register to Ask a Question