RE: shell script to count httpd processes

From: Brian D. McGrew (brian_at_visionpro.com)
Date: 03/14/05

  • Next message: Margaret Doll: "Single boot without mounting the partitions"
    Date: Mon, 14 Mar 2005 11:33:49 -0800
    To: "General Red Hat Linux discussion list" <redhat-list@redhat.com>
    
    

    Pgrep httpd | wc -l

    -brian
     
    Brian D. McGrew { brian@doubledimension.com ||
    brian@visionpro.com }

    --
    > YOU!  Off my planet!
    -----Original Message-----
    From: redhat-list-bounces@redhat.com
    [mailto:redhat-list-bounces@redhat.com] On Behalf Of Stamper, Steve
    Sent: Monday, March 14, 2005 11:20 AM
    To: 'General Red Hat Linux discussion list'
    Subject: RE: shell script to count httpd processes
    ps -afe | grep httpd | grep -v grep | wc -l
    -----Original Message-----
    From: redhat-list-bounces@redhat.com
    [mailto:redhat-list-bounces@redhat.com]On Behalf Of Steve Buehler
    Sent: Monday, March 14, 2005 2:02 PM
    To: redhat-list@redhat.com
    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@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Margaret Doll: "Single boot without mounting the partitions"

    Relevant Pages

    • RE: shell script to count httpd processes
      ... shell script to count httpd processes ... On Behalf Of Steve Kozakoff ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • RE: shell script to count httpd processes
      ... shell script to count httpd processes ... On Behalf Of Steve Kozakoff ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • RE: shell script to count httpd processes
      ... 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 ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • RE: shell script to count httpd processes
      ... On Behalf Of Steve Kozakoff ... shell script to count httpd processes ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • 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. ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)