@echo off
SETLOCAL ENABLEEXTENSIONS
if EXIST batch.log del batch.log

set runmode=standalone

if "%~1"=="" goto standalone
if NOT "%~1"=="service" goto standalone
set runmode=service
:standalone

echo startmgr.bat: runmode=%runmode% >> batch.log

call setmgrenv.bat %runmode%
call wowzamgrversion.bat

if not %WMSMGRENVOK% == "true" goto end

REM set CLASSPATH="%WMSMGR_HOME%\bin\wms-winstone-1.0.5-boot.jar"
REM set CLASSPATH=%CLASSPATH:\=/%
REM set CLASSPATH=%CLASSPATH://=/%

"%_EXECJAVA%" %JAVA_OPTS% -jar "%WMSMGR_HOME%\lib\wms-winstone-1.0.5-boot.jar" --prefix="/enginemanager" --defaultWebApp="/enginemanager" --tempDirectory="%WMSMGR_HOME%\temp" --webroot="%WMSMGR_HOME%\temp" --warfile="%WMSMGR_HOME%\lib\WMSManager.war" --httpPort=8088 --ajp13Port=-1 --directoryListings=false

echo startmgr.bat java returned: %ERRORLEVEL% >> batch.log

set serviceName=%WowzaMGRVersion: =%
set serviceName=%serviceName:.=%
set serviceName=%serviceName:-=%
sc stop %serviceName% > NUL
:end
