0

One of the programs in my cgi-bin folder is misbehaving. It's a compiled binary for which I do not have the source code. I would like to set up some kind of monitor to gather a list of the files that the program opens when it gets executed and dump that into a text file.

It looks like lsof might have that info, but since the CGI program is transient and typically finishes execution in under a second, it's not really practical to run lsof from the command line at the same time. For that matter, I'm not even sure if the CGI program would show up as itself or if the activity would be registered to the httpd process.

The server is running Red Hat Enterprise Linux 6.4 with Apache 2.2.15, and I have root access.

Suggestions?

Will Martin
  • 2,431
  • 5
  • 19
  • 18

1 Answers1

1

You can use strace to find out what your cgi-bin program does. See this question on StackOverflow about how to use strace.

AlexD
  • 8,747
  • 2
  • 29
  • 38
  • This did the trick. I was able to write a wrapper for the binary that ran it through strace and dumped the output to /tmp. Thanks! – Will Martin Apr 17 '13 at 18:43