RE: shell script to count httpd processes

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

 



ps -afe | grep httpd | grep -v grep | wc -l

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Steve Buehler
Sent: Monday, March 14, 2005 2:02 PM
To: redhat-list@xxxxxxxxxx
Subject: shell script to count httpd processes


I am running RHL 7.3.
I am trying to create a shell script with /bin/sh that will count how many 
httpd processes are running at the time.
This is how it would look as a perl script:
---start of script---
#!/usr/bin/perl
$count = 0;
@hits = (`ps -afe | grep httpd | grep -v grep`);
   foreach $entry (@hits) {
     $count++;
}
print "$count\n";
---end of script---

I am trying to do this in an sh script.  Partly for learning partly because 
I want to do some other things to, but can only know how to do them in a 
shell script.  Any help would be greatly appreciated.

Thanks
Steve

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux