httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Coby" <jc...@listingbook.com>
Subject Re: Re[2]: [users@httpd] Testing if a Webserver is down
Date Thu, 31 Oct 2002 16:01:15 GMT
> AST> You could ping the domain in a loop
> AST> ping <IP> -t
>
> Yes, I know, but how can I check it with a bash script?
>
> I  pipe  the  output  of  the ping comand through grep and count the
> returned lines? But I really no nothing about bash-programming!

Using ping is a bad idea, it won't give you meaningful results, unless the
server is on fire or turned off.  I've had a webserver here go down (kernel
panic), and it still responds to ping.

Bash is really pretty easy to program for, using wget you can do:

#!/bin/bash

wget -t 1 -T 30 -q www.asdfjklsadfsdf.com

if [ $? == 0 ]; then
  echo 'server is up!';
else
  echo 'server is down!';
fi
----

from there, it's just a matter of plugging in your own scripts on what to do
when the server is down :)

Another option is nagios, a daemon that runs on one server and monitors
other servers.  Comes with a web interface with nice features, and can email
or page people responsable for bringing the downed server back up.

-Jacob


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message