@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:\Program Files\AlwaysUp\http-ping.exe" http://localhost:80 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! exit 2 :success echo Succeeded! exit 0 :failure echo Failed! exit 1