Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.