Running "sudo serivce httpd status" shows only a single process id. The root process. However, if I use top or ps, I can see there are more process than that. Apache is in prefork mode.

Has anyone seen this behavior before from Apache2?

I'd like to understand why the status command can't find the other processes.


The other processess you see in your qa server are the result of the command:

pidof httpd

If you check the code for the status function in /etc/init.d/functions, you will see how these results are generated and test why you only see the parent httpd process.

I think is has to be with sudo not working for pidof, try again with the root user.

| improve this answer | |
  • Thanks. 'pidof httpd' returns the result I expected to see. Running it as root returns the same value. – txyoji Sep 15 '09 at 18:49

Does it matter? You're asking if apache is running. The command is telling you that it is. If you kill that process, the others will die too.

I suspect the command could find the others. It just can't be bothered.

| improve this answer | |
  • I have an 'identical' qa version of this server, which returns a list of all the processes. Seems like it could be a symptom of a larger problem. – txyoji Sep 15 '09 at 15:23

Apache has a single control process that is responsible for launching child processes. The processes ID you get from "service httpd status" is the PID of the control process.

| improve this answer | |

I have the same result:

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

As the others have said, this is the main process ID; any other processes are child processes. If you need information on these, you should install mod_status which allows for ExtendedStatus and pulling all kinds of neat information from 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.
| improve this answer | |
  • Nice to know its normal on other systems too. Thanks. – txyoji Sep 15 '09 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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