1832934 Members
3029 Online
110048 Solutions
New Discussion

httpd check

 
SOLVED
Go to solution
Nobody's Hero
Valued Contributor

httpd check

If I were to write a script to check if httpd (apache) is really operating ok, what flag would I use to build into a script check?

httpd -help
Usage: httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-F]
Options:
-D name : define a name for use in directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled-in modules
-L : list available configuration directives
-S : show parsed settings (currently only vhost settings)
-t : run syntax check for config files (with docroot check)
-T : run syntax check for config files (without docroot check)
-F : run main process in foreground, for process

That is, which command would really tell me if apache was up and working?
UNIX IS GOOD
4 REPLIES 4
Nobody's Hero
Valued Contributor

Re: httpd check

I do understand that checking the pid is not the best method.
UNIX IS GOOD
Steven E. Protter
Exalted Contributor

Re: httpd check

Shalom,

The best method is to see if you can get content from another system.

wget http://websitname/

By default this will get index.html

wget works on HP-UX with effort, and is standard with Linux.

A network outage would trigger a wget based script to send hour warnings. However the point is to provide service on the network, so that is where the check should be run.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Wim Rombauts
Honored Contributor

Re: httpd check

I think httpd itself has no options to check if the HTTP-server is up and functional.

What I do in a serviceguard checkscript to not only see that our HTTPD is alive, but that the starting page of an application is accessible is :

RESPONSE=$(telnet localhost 80 2>>/dev/null <
Torsten.
Acclaimed Contributor
Solution

Re: httpd check

I would request a page from the server. If you get it, the server is running.

example:

# telnet 127.0.0.1 80
Trying...
Connected to 127.0.0.1.
Escape character is '^]'.
GET index.html


...


But you can also use

apachectl status

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!