Solved

Truss on process to check the files referenced by it.

Posted on 2008-10-18
8
782 Views
Last Modified: 2013-12-27
How do i run truss on a process id to check the files opened by it on solaris 10?

I am looking for an output like below..





/16:    stat64("/usr/share/webconsole/webapps/console/WEB-INF/web.xml", 0xE637E938) = 0

/16:    access("/usr/share/webconsole/webapps/console/WEB-INF/web.xml", R_OK) = 0

/16:    stat64("/usr/share/webconsole/webapps/console/WEB-INF/web.xml", 0xE637E998) = 0

/16:    stat64("/usr/share/webconsole/webapps/console/WEB-INF/web.xml", 0xE637E9A8) = 0

/16:    stat64("/usr/share/webconsole/webapps/console/WEB-INF", 0xE637E938) = 0

/16:    access("/usr/share/webconsole/webapps/console/WEB-INF", R_OK) = 0

/16:    stat64("/usr/share/webconsole/webapps/console/WEB-INF", 0xE637E998) = 0
0
Comment
Question by:p0sreed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 6

Expert Comment

by:wwnosal
ID: 22747721
Depening if you have it installed lsof -p pid might be a bit nicer to read

0
 

Author Comment

by:p0sreed
ID: 22761597
We don't have lsof installed on all the boxes.

I am looking for the similar output as in my example.
0
 
LVL 22

Expert Comment

by:blu
ID: 22965355
I am not sure if you are asking to monitor new files being opened or old files that are already opened. If the former, then truss will do it, just as you showed above. If the latter, then you should use the pfiles command. If there is something else in addition I don't understand, then please let me know
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:p0sreed
ID: 22965415
I am talking about new files being opened.

what is the proper truss command to produce the output that i pasted in my first post.
0
 
LVL 22

Expert Comment

by:blu
ID: 22966409
Okay, one more question. In your example, your show only access and stat64 lines. Do you want only those two, or any syscall that touches a file by filename?

For the former, you want this:

truss -l -taccess,stat64 -s!all -p pid

You might want to try adding stat and lstat to the above list, depending on your purpose.

However, if you want to catch any file, then you need to add a bunch more syscalls to the above  list.
0
 

Author Comment

by:p0sreed
ID: 22974258
root@clyde:/ # truss -l -taccess,stat64 -s!all -p 558
bash: !all: event not found
root@clyde:/ #

0
 
LVL 22

Accepted Solution

by:
blu earned 500 total points
ID: 22975033
You are using the c-shell, which uses the ! character as the history substitution character. Either use a different shell or escape the ! with a backslash:

truss -l -taccess,stat64 -s\!all -p 558
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question