RE: [users@httpd] How to tell if Apache is really running

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

 



Since apache does not have a 'status' in it's init script here is one.
Simple copy this into a file and make it executable. This file does assume
you have perl available. If you look closely you can edit this file to
provide status of almost any running process.

******* Begin cut *******
#!/usr/bin/perl

use warnings;
use strict;

printStatus ("Apache", getApacheStatus());

sub printStatus
{
    my( $name, $status ) = @_;

    if( defined $status )
    {
        print "$name is $status\n";
    }
    else
    {
        warn "Unable to determine status of $name : $!\n";
    }
}

sub getServiceStatus
{
    my ($pidfile) = @_;

    if( -f $pidfile )
    {
        open( PIDFILE, $pidfile ) or return undef;
    
        my $pid = <PIDFILE>;
        
        chomp $pid;
        
        close( PIDFILE ) or return undef;

        my $status = `ps -p $pid -o pid=`;
        
        if( $status =~ /$pid/ )
        {
            return "running";
        }
        else
        {
            return "not running (pid exists)";
        }
    }
    else
    {
        return "not running (no pid)";
    }
}              

sub getApacheStatus 
{
    return getServiceStatus( '/var/run/apache.pid' );
}

******* End cut ******* 


 
Tony Heal
Pace Systems Group, Inc.
800-624-5999
theal@xxxxxxxxxxxx
 

-----Original Message-----
From: Graves, Jan [mailto:Jan.Graves@xxxxxxx] 
Sent: Thursday, July 06, 2006 10:16 AM
To: users@xxxxxxxxxxxxxxxx
Subject: [users@httpd] How to tell if Apache is really running

First I have to apologize to all of you Apache experts for what will sound
like a stupid question.  However, I am new to Apache and will admit that I
have not a clue what I am doing with it.  How can I tell if Apache is really
running, since now matter what I cannot access the web site this server
should be hosting?

This command    ps -ax |grep http          produces the following results:
 1029  ??  Ss     0:00.46 /usr/local/sbin/httpd
 1030  ??  I      0:00.00 /usr/local/sbin/httpd
 1031  ??  I      0:00.00 /usr/local/sbin/httpd
 1032  ??  I      0:00.00 /usr/local/sbin/httpd
 1033  ??  I      0:00.00 /usr/local/sbin/httpd


I am running Apache Version 1.3 on a Unix system.  Things were running fine
until storms took out the power over the week-end and the system needed to
be re-started.  This system was set up by a third party company who no
longer provides support.  So, I am trying to determine what the problem is.
The Unix system itself starts and all of the processes that I expect, except
Apache.  

I have attached the error log file.  If anyone needs further information,
please let me know.  I will try to find it.  In looking at the Apache site,
I know that things were not left in default places.


Thanks in advance for any suggestions.

 
Jan Graves
Network Administrator/Engineer
Lenawee Intermediate School District
4107 N. Adrian Highway
Adrian, MI 49221
Phone: 517-265-1634
Fax:     517-265-7405
Visit us on the web at http://lisd.k12.mi.us
 



---------------------------------------------------------------------
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