Re: A number of Apache processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



André Warnier wrote:
export@xxxxxxx wrote:
Is there a way how to find out, from an external program running on the
same machine, a number of a total http  Apache's processes ?
What command must I use in my C  or Python program?
Thanks for help.
L.

At the command-line :

ps -ef | grep httpd | grep -v grep | wc -l
or, better :
ps -ef | grep "[h]ttpd" | wc -l

(replace by "apache" or "apache2" if needed.)


At the program level :
find the function that lets you execute a system command and capture it's output, then use the above as command.
e.g. in perl you can just do :
my $var = `ps -ef | grep "[h]ttpd" | wc -l`;

There are a number of more sophisticated alternatives in each programming language, but that's a simple way.
---------------- End original message. ---------------------

You are of course assuming that the OP is using an OS that is Unix-like that supports these commands (Linux, BSD, OSX, Solaris, etc.).

All bets are off if the OP is using Windows. That would require digging into the Windows SDK to enumerate the system task list.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux