pid

解决Tomcat无法shutdown进程

天大地大妈咪最大 提交于 2019-12-02 08:35:48
问题分析 这个在windows下没有碰到过,因为此前跑Tomcat都是以服务而不是命令脚本的形式跑的,而且已经换了一个项目,所以暂时不考察windows下是否存在该问题。 难道是Tomcat版本问题?或者用带内存泄漏保护的Tomcat 7可以解决该问题?尝试将web应用跑在apache-tomcat-6.0.18、apache-tomcat-6.0.35、apache-tomcat-7.0.34,发现均存在无法shutdown.sh进程问题。 难道在CentOS(Linux)下,Tomcat无法用shutdown.sh停掉进程?显然不可能的。于是又把web应用从webapps中移走,换回tomcat自带的ROOT,果然启动后再shutdown.sh,查找不到原来的tomcat进程了,也就证明了是自己web应用的问题了。 解决方案 现在已经确定是web应用的问题了,所以可以提解决方案了。 Kill进程,修改tomcat bin目录下shutdown.sh和catalina.sh文件 忽略日志中的严重警告,因为这是关闭tomcat时候引起的,正常情况下不会发生这种内存泄露情况,而且Tomcat6.18以上版本的Tomcat已经做了内存泄露保护,交给Tomcat完成吧,我们只需要在shutdown.sh之后,补上一个kill -9 pid即可。要是嫌这样太麻烦了,可以如下这样改: ===

How do I obtain the PID of a spawned java process

只愿长相守 提交于 2019-12-02 07:13:35
问题 I am writing several java programs and will need to kill off/clean up in a seperate JVM after I am done with whatever I wanted to do. For this, I will need to get the PID of the java process which I am creating. 回答1: jps -l works both on Windows and Unix. You can invoke this command from your java program using Runtime.getRuntime().exec . Sample output of jps -l is as follows 9412 foo.bar.ClassName 9300 sun.tools.jps.Jps You might need to parse this and then check for the fully qualified name

Changing the Process Id in linux

拥有回忆 提交于 2019-12-02 04:02:20
问题 Is it possible to change the process id in linux operating system. If anyone know, please tell me. Requirement :actually i want to bring up the back ground process to fore ground , which is being run under the init. So if i can change the process id or parent process id of the process. i can achieve my goal. 回答1: No, it's not possible to do such a thing on Unix. You might be able to use fork to achieve this effect, but you have to tell us what you are trying to achieve. pid_t pid; /* I want a

Get PID of process after fork in Qt

試著忘記壹切 提交于 2019-12-02 03:17:08
I am creating a Qt/C++ console application which successfully forks. When I call QCoreApplication::applicationPid() before fork, and then after fork (in the child), I get the same pid. I realize I could just use the return value from fork() but I'm trying to do things the Qt way. Is there a better/right way to get the PID of the child (from within the child) in Qt? And out of curiosity, why isn't QCoreApplication::applicationPid() providing the new PID? I assume it's now providing the ppid.... Albert The return value of fork() depends whether you are in the fork or in the parent. See here : On

How to get each Process ID when multiprocessing

夙愿已清 提交于 2019-12-02 03:04:54
问题 I have some problems because I'm newbie in Python and Pyside. I have N processes which are running at the same time. Since these processes take some times to finish their job, it's possible that end user wants to cancel a specific process. So I need a way to know the IDs of processes for adding this feature to the program. There is an answer in Stackoverflow which is exactly what I'm doing. Here is the code : #!/usr/bin/env python3 import multiprocessing, multiprocessing.pool, time, random,

Changing the Process Id in linux

匆匆过客 提交于 2019-12-02 02:21:57
Is it possible to change the process id in linux operating system. If anyone know, please tell me. Requirement :actually i want to bring up the back ground process to fore ground , which is being run under the init. So if i can change the process id or parent process id of the process. i can achieve my goal. No, it's not possible to do such a thing on Unix. You might be able to use fork to achieve this effect, but you have to tell us what you are trying to achieve. pid_t pid; /* I want a new PID. */ pid fork(); if (pid == 0) { /* getpid() will show I've got a new PID. */ else _exit(0); /*

C - Get PID of process opened with popen

耗尽温柔 提交于 2019-12-02 02:17:42
问题 I have a program written in C, which opens another program using popen. I 'd like to get the pid of that program or some kind of handler for it, so as to kill it after a certain time limit, or if it exceeds some ram, and stdout limits. I think this must be done with ptrace, which needs the PID, which I don't know how to obtain. 回答1: Just write your own implementation of popen that returns the PID. It's much less ugly than some crazy hackery around the existing popen . You can find source code

How do I obtain the PID of a spawned java process

大城市里の小女人 提交于 2019-12-02 02:16:36
I am writing several java programs and will need to kill off/clean up in a seperate JVM after I am done with whatever I wanted to do. For this, I will need to get the PID of the java process which I am creating. jps -l works both on Windows and Unix. You can invoke this command from your java program using Runtime.getRuntime().exec . Sample output of jps -l is as follows 9412 foo.bar.ClassName 9300 sun.tools.jps.Jps You might need to parse this and then check for the fully qualified name and then get the pid from the corresponding line. private static void executeJps() throws IOException {

How to get all descendent child process id of pid in c in linux [duplicate]

孤人 提交于 2019-12-02 02:09:21
问题 This question already has answers here : How to get child process from parent process (7 answers) Closed 5 years ago . If I fork and the child process then exec and creates more child processes (which themselves can create more processes) , how do I get a list of pid s of all the descendent process from the first process? Is there a better way then looping though /proc/ and checking the PPid (the parent of process's id) of each of process? 回答1: Iterating through /proc is the "standard" way to

C - Get PID of process opened with popen

Deadly 提交于 2019-12-01 21:19:39
I have a program written in C, which opens another program using popen. I 'd like to get the pid of that program or some kind of handler for it, so as to kill it after a certain time limit, or if it exceeds some ram, and stdout limits. I think this must be done with ptrace, which needs the PID, which I don't know how to obtain. Just write your own implementation of popen that returns the PID. It's much less ugly than some crazy hackery around the existing popen . You can find source code to popen implementations all over the net. Here's one . You might also be able to use ulimits and other