text
stringlengths
0
834k
TIMEOUT 1 >nul
COLOR 4f
TIMEOUT 1 >nul
COLOR cf
TIMEOUT 1 >nul
COLOR 4f
TIMEOUT 1 >nul
COLOR cf
TIMEOUT 1 >nul
COLOR 0c
GOTO CLEANUP
:RESTARTER
COLOR 6F
REM Quick-check EULA before commencing full restarter logic
>nul FIND /I ""eula=true"" ""%~dp0eula.txt"" || (
TITLE ERROR: EULA.TXT Must be updated before %MC_SERVER_PACKNAME% server can start
CLS
ECHO.
ECHO Could not find ""eula=true"" in eula.txt file
ECHO Please edit and save the EULA file before continuing.
ECHO.
PAUSE
GOTO STARTSERVER
)
ECHO ERROR: At %MC_SERVER_CRASH_YYYYMMDD%:%MC_SERVER_CRASH_HHMMSS% Server has stopped. 1>> ""%~dp0serverstart.log"" 2>&1
ECHO At %MC_SERVER_CRASH_YYYYMMDD%:%MC_SERVER_CRASH_HHMMSS% Server has stopped.
ECHO Server has %MC_SERVER_CRASH_COUNTER% consecutive stops, each within %MC_SERVER_CRASH_TIMER% seconds of eachother...
ECHO DEBUG: Server has %MC_SERVER_CRASH_COUNTER% consecutive stops, each within %MC_SERVER_CRASH_TIMER% seconds of eachother... 1>> ""%~dp0serverstart.log"" 2>&1
ECHO.
REM Arithmetic to check DAYS since last crash
REM Testing working in USA region. Hoping other regional formats don't mess it up
SET /a MC_SERVER_TMP_FLAG=""%date:~10,4%%date:~4,2%%date:~7,2%-%MC_SERVER_CRASH_YYYYMMDD%""
REM If more than one calendar day, reset timer/counter.
REM Yes, this means over midnight it's not accurate.
REM Nobody's perfect.
IF %MC_SERVER_TMP_FLAG% GTR 0 (
ECHO More than one day since last crash/restart... resetting counter/timer
ECHO INFO: More than one day since last crash/restart... resetting counter/timer 1>> ""%~dp0serverstart.log"" 2>&1
SET MC_SERVER_CRASH_YYYYMMDD=%date:~10,4%%date:~4,2%%date:~7,2%
SET MC_SERVER_CRASH_HHMMSS=%time:~0,2%%time:~3,2%%time:~6,2%
SET MC_SERVER_CRASH_COUNTER=0
GOTO BEGIN
)
REM Arithmetic to check SECONDS since last crash
SET /a MC_SERVER_TMP_FLAG=""%time:~0,2%%time:~3,2%%time:~6,2%-%MC_SERVER_CRASH_HHMMSS%""
REM If more than specified seconds (from config variable), reset timer/counter.
IF %MC_SERVER_TMP_FLAG% GTR %MC_SERVER_CRASH_TIMER% (
ECHO Last crash/startup was %MC_SERVER_TMP_FLAG%+ seconds ago
ECHO INFO: Last crash/startup was %MC_SERVER_TMP_FLAG%+ seconds ago 1>> ""%~dp0serverstart.log"" 2>&1
ECHO More than %MC_SERVER_CRASH_TIMER% seconds since last crash/restart... resetting counter/timer
ECHO INFO: More than %MC_SERVER_CRASH_TIMER% seconds since last crash/restart... resetting counter/timer 1>> ""%~dp0serverstart.log"" 2>&1
SET MC_SERVER_CRASH_YYYYMMDD=%date:~10,4%%date:~4,2%%date:~7,2%
SET MC_SERVER_CRASH_HHMMSS=%time:~0,2%%time:~3,2%%time:~6,2%
SET MC_SERVER_CRASH_COUNTER=0
REM GOTO BEGIN
)
REM If we are still here, time difference is within threshold to increment counter
REM Check if already max failures:
IF %MC_SERVER_CRASH_COUNTER% GEQ %MC_SERVER_MAX_CRASH% (
COLOR cf
SET MC_SERVER_ERROR_REASON=TooManyCrashes:%MC_SERVER_CRASH_COUNTER%
ECHO INFO: Last crash/startup was %MC_SERVER_TMP_FLAG%+ seconds ago 1>> ""%~dp0serverstart.log"" 2>&1
ECHO.
ECHO.
ECHO ===================================================
ECHO ERROR: Server has stopped/crashed too many times!
ECHO ===================================================
ECHO ERROR: Server has stopped/crashed too many times! 1>> ""%~dp0serverstart.log"" 2>&1
ECHO.
>nul TIMEOUT 1
ECHO %MC_SERVER_CRASH_COUNTER% Crashes have been counted each within %MC_SERVER_CRASH_TIMER% seconds.
>nul TIMEOUT 1
GOTO ERROR
)
REM Still under threshold so lets increment and restart
ECHO INFO: Last crash/startup was %MC_SERVER_TMP_FLAG%+ seconds ago 1>> ""%~dp0serverstart.log"" 2>&1
SET /a ""MC_SERVER_CRASH_COUNTER=%MC_SERVER_CRASH_COUNTER%+1""
SET MC_SERVER_CRASH_YYYYMMDD=%date:~10,4%%date:~4,2%%date:~7,2%
SET MC_SERVER_CRASH_HHMMSS=%time:~0,2%%time:~3,2%%time:~6,2%
ECHO DEBUG: Total consecutive crash/stops within time threshold: %MC_SERVER_CRASH_COUNTER% 1>> ""%~dp0serverstart.log"" 2>&1
ECHO.
ECHO.
ECHO.
ECHO.
ECHO Server will re-start *automatically* in less than 30 seconds...
CHOICE /M:""Restart now (Y) or Exit (N)"" /T:30 /D:Y
IF %ERRORLEVEL% GEQ 2 (
ECHO INFO: Server manually stopped before auto-restart 1>> ""%~dp0serverstart.log"" 2>&1
GOTO CLEANUP
) ELSE (
GOTO BEGIN