1
Obs.: I believe it is error in the variables, because the loops do not work.
This code stores the average execution time of backups SQL of the month and
uses this time to limit the execution time of backup. If time is greater than the average * 2 + 60
he has to give Kill in the CMD process to close other batch files that have been scheduled and may be running or crashing.
I did it through an accountant at if
, but the conditionals aren’t working.
echo MONITOR DE ERRO BKUP SQL
@echo on
:: get date
for /F "tokens=1-3 delims=/ " %%i in ('date /t') do (
set dd=%%i
set mm=%%j
set yy=%%k
)
if exist "%temp%\sqldump_elapsed_time%yy%%mm%.txt" (
set /p sqldump_elapsed_time=<"%temp%\sqldump_elapsed_time%yy%%mm%.txt"
set /a "tempolimite = (sqldump_elapsed_time * 2) + 60"
set /a "count = 0"
pause
:DELAYFUNCTION
if count LEQ tempolimite (
if not exist "%temp%\sqldump_bkcup_confirm.txt" (
TIMEOUT 1 /nobreak
set /a "count = count + 1"
echo %count%
echo %tempolimite%
goto :DELAYFUNCTION
)
if exist "%temp%\sqldump_bkcup_confirm.txt" (
set /p verificador=<"%temp%\sqldump_bkcup_confirm.txt"
if verificador=="ok" (
echo Backup Confirmado - Fechar Programa
pause
exit /b
)
)
)
)
>"%temp%\ver.txt" echo %verificador%
echo Backup ERRO - KILL no CMD
pause
REM ESCREVER FUNÇÃO TASKKILL CMD.EXE (PROCURAR COMO ESCREVE)
exit /b