批处理 Mysql Findstr

@set Dump_IP=localhost
@set User_Name=root
@set Password=1234

@set curPath=%~dp0

mysql -h %Dump_IP% -u%User_Name% -p%Password% -e "show slave statusG">%curPath%Slave_Status.txt

@Rem find any row of Slave_Running_No.txt in Slave_Status.txt
findstr /g:%curPath%Slave_Running_No.txt %curPath%Slave_Status.txt>nul
if %errorlevel% equ 0 (
  Rem found it
  mysql -h %Dump_IP% -u%User_Name% -p%Password% -e "…">nul
  Rem Waiting for 5 seconds
  @ping -n 5 127.0.0.1>nul
  mysql -h %Dump_IP% -u%User_Name% -p%Password% -e "…">nul
)

pause
原文地址:https://www.cnblogs.com/krisy/p/3666104.html