Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Truss on process to check the files referenced by it.

Posted on 2008-10-18
8
Medium Priority
?
786 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
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…
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

670 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