http ping para reiniciar o serviço

1

Esta ferramenta verifica se um site está offline ou não. link

Estou tentando criar um processo automatizado para executar esse arquivo e verificar domain.com, se o ping falhar e parar - > iniciar o apache.

Eles têm um código de exemplo em seu site, que modificamos e parecemos,

@echo off
REM This batch file is for use with AlwaysUp (http://www.coretechnologies.com/products/AlwaysUp/) or Service Protector (http://www.coretechnologies.com/products/ServiceProtector/)
REM Copyright � 2001-2012 Core Technologies Consulting, LLC. All rights reserved.


REM Ping your web server
REM *** Please change the location of http-ping.exe if necessary and adjust the URL to point to your web server ***
"C:\http-ping.exe" http://www.domain.com

REM http-ping returns the percentage of pings that succeed. With 4 attempts, this can be 0, 25, 50, 75, or 100.
REM Any of the 4 pings succeeds consider it a success ==> return 0 so that AlwaysUp doesn't restart
IF ERRORLEVEL 25 GOTO success
IF ERRORLEVEL 50 GOTO success
IF ERRORLEVEL 75 GOTO success
IF ERRORLEVEL 100 GOTO success

REM Exit code of 0 ==> all failed ==> return 1 to have AlwaysUp restart the application
IF ERRORLEVEL 0 GOTO failure


REM http-ping returned a code < 0 ==> there was some other kind of failure. Don't restart, but have AlwaysUp log the failure ==> return 2
echo http-ping failed!
net stop Apache2.4
net start Apache2.4
exit 2

:success
echo Succeeded!
exit 0

:failure
echo Failed!
net stop Apache2.4
net start Apache2.4
exit 1

Mas isso não funciona. Usando o Windows, o Apache, e estou usando o recurso de planejamento no sistema operacional para automatizá-lo.

O utilitário regular de ping do Windows não pode fazer o que estou procurando.

Aprecie qualquer ajuda.

    
por D_Guy13 18.05.2013 / 15:59

0 respostas