Apache的状态只显示一个进程

运行“sudo serivce httpd status”只显示一个进程ID。 根进程。 但是,如果我使用top或ps,我可以看到有更多的过程。 Apache处于prefork模式。

有没有人从Apache2之前看到过这种行为?

我想了解为什么状态命令找不到其他进程。

您在qa服务器中看到的其他过程是命令的结果:

pidof httpd 

如果您在/etc/init.d/functions中检查状态函数的代码,您将看到如何生成这些结果并testing为​​什么只能看到父httpd进程。

我认为是必须与sudo不工作的pidof,再次尝试与root用户。

有关系吗? 你问,如果Apache正在运行。 该命令告诉你,它是。 如果你杀了这个过程,其他人也会死。

我怀疑命令可以find其他人。 它不能被打扰。

Apache有一个负责启动subprocess的控制进程。 您从“服务httpd状态”获得的进程ID是控制进程的PID。

我有同样的结果:

 root@serverX:~# sudo service apache2 status * Apache is running (pid 2958). 

正如其他人所说,这是主要的进程ID; 其他任何进程都是subprocess。 如果你需要这些信息,你应该安装mod_status ,它允许使用ExtendedStatus并从Apache中获取各种简洁的信息。

 The details given are: - The number of worker serving requests - The number of idle worker - The status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker (*) - A total number of accesses and byte count served (*) - The time the server was started/restarted and the time it has been running for - Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*) - The current percentage CPU used by each worker and in total by Apache (*) - The current hosts and requests being processed (*) The lines marked "(*)" are only available if ExtendedStatus is On.