开发者

linux - process already running error

I am trying to start a process and although ps -ef|grep myprocessname does not show it runnin开发者_如何学Gog, when I invoke the script to start it it says process already running, exiting.

I have searched internet for about one hour and I can not find any answers. Can anyone help? Thank you.

@TILO: There is no file under /var/run that has a name even close to my process. Any other suggestions?

@VKRAM: This is a third party software. Any suggestions?


check under /var/run if there is a .pid file for the process you're trying to start.

e.g. /var/run/mysqld/mysqld.pid would be such a file.

That file contains the PID of the process...

run a ps -edaf | grep PID # with the pid you find in the file

if the process is not found, you can delete the pid-file -- then try starting your process again


Try using strace on the program in question:

strace yourprogram

Shortly before it terminates, you should see the system calls it used to determine that another instance was running, and can from there reverse engineer the method it is using.


you said you can't find the PID-file...

  1. If you can't find the PID file (maybe because some of the directories under /var/run are deeply nested), try this to see a list of all PID-files in there:

    find /var/run -type f -name '*.pid'

    find /var -type f -name '*.pid'

    maybe you'll see a filename that looks similar to the process name you're trying to start. Or you can also put a grep at the end of that line and try to grep for the process name in the list.

  2. Some programs put use also lock files -- these can be usually found under /var/lock/ or /var/lock/subsystem

  3. If that doesn't help, try to look at the start-script that you're using , e.g. under /etc/init.d/ Look at it in detail and look for something like LOCK_FILE or PID_FILE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜