@@cd /d %~dp0
@echo off
title Login Server Console
:start
@@DEL __wait__ 2>NUL
echo Starting L2J Login Server.
echo.
@@move UPDATE\l2jserver.jar . 2>NUL
@@call L2LogRotate.bat
SET JAVA=java -Xms128m -Xmx128m  -cp ./../libs/*;l2jserver.jar com.l2jserver.loginserver.L2LoginServer
@@cmd /v:on /c "%JAVA% 2>&1 & echo exit /b !ERRORLEVEL! > __errorlevel.bat" |tee log/stdout.log
@@call __errorlevel.bat
if ERRORLEVEL 2 goto restart
if ERRORLEVEL 1 goto error
goto end
:restart
echo.
echo Admin Restart ...
echo.
goto start
:error
echo.
echo Server terminated abnormaly
echo.
:end
@@IF EXIST __wait__ waitServer.bat %0
echo.
echo server terminated
echo.
@@IF "%~0" == "%cd%\%~nx0" @PAUSE
