Windows Scripts - GeheimagentNr1/AutoRestart GitHub Wiki
Everything, that is in angle brackets (<>) in the examples, must be replaced, by what is described in them.
Restart Command Script
This script can be used to run the server once, i.e. if you configured Auto Restart to not use an external restart script.
You configure "restart_command" as the script with the path, where your start-script is located, i.e "<Path of your Minecraft server>\\<Name of your script>.cmd" (All "\" have to be "\\")
cd "<Path of your Minecraft server>"
start java -jar forge-<Minecraft version>-<Forge version>.jar
External Restart Script
These scripts are for the use, if you have configured, that you are using an external restart script.
The first script is named "restart_start.cmd". It is used to start the "restart_loop.cmd" script in a screen.
cd "<Path of your Minecraft server>"
start .\restart_loop.cmd
The "restart_loop.sh" script has the logic in it, to restart or stop the server. It will restart the server always, except in the "./auto_restart/restart" file is "0".
The Auto Restart Mod writes "-1", "0" or "1" to the file.
When the script reads the file,
- "-1" means that server crashed.
- "0" means the server was shutdown with the "/stop" command and should be stopped.
- "1" means the server that the server was stopped with the "/restart" command or an auto restart and should be restarted.
After the server was stopped for a restart, the script waits 5 seconds until it restarts the Minecraft server.
echo OFF
:start
java -Xmx<Amount of RAM in gigatytes you want to allocate to Minecraft>G -jar forge-<Minecraft version>-<Forge version>.jar
SET /p should_restart=<./auto_restart/restart
if %should_restart% EQU 0 goto stop
echo If you want to stop the server completely, press STRG-C, \before the countdown is at 1!
echo Rebooting in:
timeout /T 5 /nobreak
echo 'Server restarts!'
goto start
:stop