@echo off
rem set errorlevel=
set yymmddhh=%date:~6,4%%date:~0,2%%date:~3,2%
set hh=%time:~0,2%
set hh=%hh: =0%
set yymmddhh=%yymmddhh%-%hh%.log
for /f "tokens=1,2" %%a in (serverip.inf) do (
set "t=%a:~0,1%
echo %%t
if "%a:~0,2"=="[" (
echo %%a>>%yymmddhh%-%hh%.log
) else (
ping -n 1 "%%a" | find "out"
if not errorlevel 1 echo Server %%a is in unhealthy condition!>>%yymmddhh%
)
)
if exist %yymmddhh% goto error
echo All server are running well. It's a wonderful day!>>%yymmddhh%
goto end
:error
echo Some servers are suffering from problems, please check them in depth!>>%yymmddhh%
:end
rem set errorlevel=
set yymmddhh=%date:~6,4%%date:~0,2%%date:~3,2%
set hh=%time:~0,2%
set hh=%hh: =0%
set yymmddhh=%yymmddhh%-%hh%.log
for /f "tokens=1,2" %%a in (serverip.inf) do (
set "t=%a:~0,1%
echo %%t
if "%a:~0,2"=="[" (
echo %%a>>%yymmddhh%-%hh%.log
) else (
ping -n 1 "%%a" | find "out"
if not errorlevel 1 echo Server %%a is in unhealthy condition!>>%yymmddhh%
)
)
if exist %yymmddhh% goto error
echo All server are running well. It's a wonderful day!>>%yymmddhh%
goto end
:error
echo Some servers are suffering from problems, please check them in depth!>>%yymmddhh%
:end

