Gentoo Archives: gentoo-user

From: David Relson <relson@×××××××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] oder of files opened by a process
Date: Sat, 02 Oct 2010 15:42:33
Message-Id: 20101002114155.3febd1b4@osage.osagesoftware.com
In Reply to: Re: [gentoo-user] oder of files opened by a process by Darren Kirby
1 On Fri, 1 Oct 2010 11:00:33 -0600
2 Darren Kirby wrote:
3
4 > On Fri, Oct 1, 2010 at 10:29 AM, Dale <rdalek1967@×××××.com> wrote:
5 > > Al wrote:
6 > >>
7 > >> Hello,
8 > >>
9 > >> I want to find out by which file and line the */temp/environment
10 > >> script is run or sourced.
11 > >>
12 > >> As a am always interested in a general way to solve something, I
13 > >> ask if there is a tool, that displays me the order in which  files
14 > >> are read by a process.
15 > >>
16 > >> Al
17 > >>
18 > >>
19 > >
20 > > I'm not sure but you may want to check into strace.  It may be what
21 > > you are looking for.
22 > >
23 >
24 > strace may do the job in a pinch, but there is almost certainly
25 > something better suited to the task...however I don't know what it is.
26 > You may want to use like this:
27 >
28 > $ strace YourScript 2>&1 | grep open
29
30 No need to use grep to find the open operations. strace has a -feopen
31 option, i.e.
32
33 strace -feopen YourScript
34
35 >
36 > which will run YourScript and print all open() system calls to the
37 > console. You will have to sort through many unrelated calls (such as
38 > reading shared library calls) but it will show the order in which your
39 > script is opening external files. Presumably you could key in on the
40 > relevant files using more grep calls and pipes...
41 >
42 > >
43 > > Dale
44 > >
45 > > :-)  :-)
46 > >
47 > >
48 >
49 >
50 > D
51 > --
52 > --
53 > Support the mob or mysteriously disappear...
54 > I'm on flickr: http://www.flickr.com/photos/badcomputer/