English 中文(简体)
linux-进程已运行错误
原标题:linux - process already running error

我正在尝试启动一个进程,尽管ps-ef|grep myprocessname没有显示它正在运行,但当我调用脚本启动它时,它会显示进程已经在运行,正在退出。

我在网上搜索了大约一个小时,找不到任何答案。有人能帮忙吗?非常感谢。

@TILO:/var/run下没有一个文件的名称甚至接近我的进程。还有其他建议吗?

@VKRAM:这是一个第三方软件。有什么建议吗?

问题回答

请在/var/run下检查是否有您试图启动的进程的.pid文件。

例如/var/run/mysqld/mysqld.pid就是这样一个文件。

该文件包含进程的PID。。。

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

如果找不到进程,可以删除pid文件,然后尝试重新启动进程

尝试在有问题的程序上使用strace:

strace yourprogram

在它终止之前不久,您应该看到它用来确定另一个实例正在运行的系统调用,并且可以从那里对它正在使用的方法进行逆向工程。

你说找不到PID文件。。。

  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. 一些程序也使用锁定文件——这些文件通常可以在/var/lock/或/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





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签