[Linuxargentina-general] Script para ver si apache esta funcionando correctamente

Martin Gaido [eMultiSoft.com] martin_gaido en fastmail.fm
Sab Feb 5 02:42:08 CET 2005


Estimados:

Les envío un script interesante hecho en BASH, para monitorear si
nuestro servidor apache esta funcionando correctamente, luego lo pueden
poner en un cron, y obviamente lo pueden modificar, por ejemplo ahora lo
que haces es que si no esta funcionando apache por algún motivo, lo
reinicia, pero yo lo tengo en mi server que aparte me envíe un email al
cell.

----
#!/bin/bash
URL="localhost/index.html"
TIMEOUT=10 # segundos
MATCH="<html>"
restart="service httpd restart" # "service" solo funciona con MDK,
REDHAT o SUSE

wget -q -O - --timeout=$TIMEOUT --tries=1 "$URL" | grep -q "$MATCH" || {
        # Algo esta mal asi que hay que anunciar o reiniciar en este
caso
        eval "$restart"
        exit $?
}

exit 0
----

Saludos,

-- 
Martín G. Gaido
Linux+ & RHCE Certified Pro

Cell:   +54 (02477) 15590965
Office: +54 (02477) 435350
eMail:  martin_gaido en fastmail.fm
MSN IM: linux en emultisoft.com
SMS:    2477590965 en infotext.cti.com.ar
Skype:  martin_gaido

Websites:
http://www.linuxargentina.org
http://www.emultisoft.com
http://www.martingaido.com
http://www.fsf.org
http://www.debian.org
http://www.mialug.org




Más información sobre la lista de distribución Linuxargentina-general