Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @if NOT "%FTB_VERBOSE%"=="yes" (
- @echo off
- )
- :ramamount
- REM Creating a Newline variable (the two blank lines are required!)
- set NLM=^
- set NL=^^^%NLM%%NLM%^%NLM%%NLM%
- title Direwolf20 Server Startup
- cls
- for /f "skip=1" %%p in ('wmic os get freephysicalmemory') do (
- set m=%%p
- goto :ramamountagain
- )
- :ramamountagain
- set /A RamAmountReal=%m%/1024
- color 0A
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Server Start Made by xTekBlue-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo -
- echo -
- echo =================
- echo 1024 = 1GB of RAM
- echo 2048 = 2GB of RAM
- echo 3072 = 3GB of RAM
- echo 4096 = 4GB of RAM
- echo 8192 = 8GB of RAM
- echo =================
- echo -
- echo - Max Ram Amount: %RamAmountReal% -- Best to set way lower than this!
- echo -
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-How Much Ram Do You Want to use=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- set /p RamAmount=%NL%
- color 0F
- SET "var="&for /f "delims=0123456789" %%i in ("%RamAmount%") do set var=%%i
- if defined var (
- cls
- color 0C
- echo %RamAmount% is NOT a valid number, please only use 0-9 and NO commas or "MB", try again.
- timeout 5 >nul
- color 0F
- goto ramamount
- )
- cls
- call settings.bat
- if NOT EXIST %JARFILE% (
- goto install
- )
- if NOT EXIST libraries\%LAUNCHWRAPPER% (
- goto install
- )
- goto skipinstall
- :install
- echo running install script!
- call FTBInstall.bat
- :skipinstall
- REM Check if java in path
- REM TODO: use %JAVACMD%
- where java > NUL 2>&1
- if %ERRORLEVEL% NEQ 0 (
- color 0C
- echo No java binary in path. Can't run server, exiting...
- timeout 5 >nul
- color 0F
- goto :end
- )
- REM Test JVM
- REM e.g. 32-bit JVM does not have server\jvm.dll library
- java -server -version > java-test.log 2>&1
- if %ERRORLEVEL% NEQ 0 (
- echo Detected following JVM error:
- echo =======================================
- more java-test.log
- echo =======================================
- echo JVM test failed. Can't run server, Exiting...
- timeout 5 >nul
- goto :end
- )
- if not exist eula.txt (
- color 0C
- echo Missing eula.txt. Startup will fail and eula.txt will be created
- echo Make sure to read eula.txt before playing!
- timeout 5 >nul
- goto startserver
- )
- find "eula=false" eula.txt 1 > NUL 2>&1
- if %ERRORLEVEL% EQU 0 (
- color 0C
- cls
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-eula.txt found and is false, please agree to eula before starting.=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- timeout 7 >nul
- cls
- color 0F
- goto :end
- )
- if %ERRORLEVEL% EQU 1 (
- color 0A
- cls
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-eula.txt found and is true, starting server.=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- timeout 3 >nul
- color 0F
- cls
- )
- del /f /q autostart.stamp > nul 2>&1
- if "%RamAmount%"=="" (
- set RamAmount=0
- )
- :startserver
- title Determining Ram Amount...
- color 0C
- cls
- echo Determining Ram Amount...
- timeout 2 >nul
- cls
- for /f "skip=1" %%p in ('wmic os get freephysicalmemory') do (
- set m=%%p
- goto :ramcheck
- )
- :ramcheck
- set /A RamByteSize=%RamAmount%*1024
- if %m% LEQ %RamByteSize% (
- color 0C
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-RAM Size is to large, try less=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo Rebooting.
- timeout 2 >nul
- cls
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-RAM Size is to large, try less=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo Rebooting..
- timeout 2 >nul
- cls
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-RAM Size is to large, try less=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo Rebooting...
- timeout 1 >nul
- goto :ramamount
- )
- color 0A
- echo Ram Size Allowed.
- timeout 3 >nul
- cls
- echo Available Memory: %RamAmountReal% MB
- echo Physical Memory Used by Server: %RamAmount% MB (RAM Usage)
- timeout 8 >nul
- cls
- color 0A
- echo Attempting to run Server...
- timeout 2 >nul
- cls
- color 0F
- color 0F
- title Server Running...
- java -server -Xmx%RamAmount%M -XX:PermSize=%PERMGEN_SIZE% %JAVA_PARAMETERS% -jar %FORGEJAR% nogui
- echo Server Stopped!
- timeout 3 >nul
- cls
- title Direwolf20 Server Startup
- color 0A
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- echo -=-=-=-=-=-=-=-=-=-=-=-=Do you want to restart the Server? (y/n)-=-=-=-=-=-=-=-=-=-=-=-=-
- echo -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- set /p ask=%NL%
- if %ask%==y goto :ramamount
- if %ask%==Y goto :ramamount
- if %ask%==yes goto :ramamount
- if %ask%==Yes goto :ramamount
- if %ask%==YES goto :ramamount
- if %ask%==n goto :end
- if %ask%==no goto :end
- if %ask%==N goto :end
- if %ask%==No goto :end
- if %ask%==NO goto :end
- :end
- title Exiting Console...
- color 0C
- echo Exiting...
- timeout 5 >nul
- exit /B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement