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.

This question already has an answer here:

I have started a PHP script via browser and due to a loop error the script continues to be executed even after closing the browser. I am noticing it since the script is logging error messages to my logfile (path known).

We have a Apache server where many developers work together and the user is nmdev. So how can I find out what process it the one running and logging to my logfile?

ps -afe | grep php53 gives me many processes of today like:

nmdev 26518 24151 0 11:51 ? 00:00:00 /opt/xxx/yyy/apache-php5/bin/httpd -k start

share|improve this question

marked as duplicate by Iain, Ward, mdpc, dawud, Tom O'Connor Aug 27 '13 at 20:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

2 Answers

up vote 0 down vote accepted

The solution for my problem was to use:

/sbin/fuser /path/to/logfile

That gave me all the processes writing to the file. I killed them all without mercy. Problem solved.

share|improve this answer
add comment

The tool lsof with the complete path of your file will give you a list of all processes which are accessing to it.

Example:

me@home ~ % lsof /home/me                                    
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
i3bar      1894 me  cwd    DIR    8,3    32768 4718593 /home/me
j4status   1895 me  cwd    DIR    8,3    32768 4718593 /home/me
germinal   1899 me  cwd    DIR    8,3    32768 4718593 /home/me
share|improve this answer
    
Yes I know lsof but it is not available -bash: lsof: command not found and I am not root. –  Indianer Aug 27 '13 at 11:01
    
Perhaps you should install it in this case... –  etagenklo Aug 27 '13 at 11:32
    
Ok, just saw you're NOT root. You'll have to be root (or at least be allowed to use sudo) in order to use lsof... –  etagenklo Aug 27 '13 at 11:33
add comment

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