The definition of the cycle interval and monitoring services

OFF @echo
REM cycle defined time interval and monitoring services:
SET = 60 secs
SET srvname = "Nginx"

echo.
echo ======================== ================
echo state == querying computer services, ==
echo == intervals% secs% seconds a query, ==
echo == found it to stop , start immediately. ==
echo ========================================
echo.
Echo This script monitoring service:% srvname%
. echo

..% srvname% == IF GOTO End

: chkit
SET svrst = 0
for / F. "tokens. 1 * = delims =" %% A in ( 'NET Start') do IF / the I " a %% B %% "==% srvname% SET = svrst. 1
IF% svrst% NET == 0 Start% srvname%
SET = svrst
REM following command delay could cause a single core cpu full.
-n% secs% 127.0.0.1 the ping> NUL
GOTO chkit

: End

Guess you like

Origin www.cnblogs.com/zhoading/p/11987013.html