@echo off
setlocal

set CATALINA_HOME=%~dp0..\tomcat
set JAVA_HOME=%~dp0..\jre11
set ASA_HOME=%~dp0..\ASA
set SESM_BIN=%~dp0..\bin

if %ERRORLEVEL% == 2 goto end


:begin
"%SESM_BIN%\JavaLaunchTool.exe" -Xms256m -Xmx512m -classpath "%~dp0\tools.jar;%SESM_BIN%\inst.jar;%SESM_BIN%\inst-res.jar;%~dp0..\tomcat\lib\sajdbc4.jar;" -Dcatalina.home="%CATALINA_HOME%" -Djava.library.path="%CATALINA_HOME%\bin;%ASA_HOME%\win32;%ASA_HOME%\win64" com.sygate.scm.tools.monitor.SepmMonitor "%CATALINA_HOME%"
set TEMP_ERROR_LEVEL=%ERRORLEVEL%

if %TEMP_ERROR_LEVEL% EQU 0 goto noerror
if %TEMP_ERROR_LEVEL% NEQ 0 goto error2

goto end

:noerror
cls
@echo Content Distribution Monitor has been started. Please refer tomcat/logs/ContentDistributionMonitor.log file for results.
goto end

:error2
cls
@echo Failed to launch process JavaLaunchTool.exe
goto end

:end
endlocal
pause