-
Notifications
You must be signed in to change notification settings - Fork 6
Simple Instructions: 1.3 Setup (MC 1.16.5 or older, Windows, Restart Script)
In this example, we suppose, that you installed the Minecraft server in the directory "C:\servers\Minecraft Server\" and use the Minecraft version 1.16.5 and the Forge version 36.2.23.
First, you create a file named restart_start.cmd in the "C:\servers\Minecraft Server\" directory.
Next, you insert the restart start script into the restart_start.cmd file:
cd "<Path of your Minecraft server>"
start .\restart_loop.cmd
In our example, the Minecraft server is in the directory "C:\servers\Minecraft Server\" installed and the restart_start.cmd file would look like this:
cd "C:\servers\Minecraft Server\"
start .\restart_loop.cmd
As a third step, you create a file named restart_loop.cmd in the "C:\servers\Minecraft Server\" directory.
Next, you insert the restart loop script into the restart_loop.cmd file:
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
In our example we give the Minecraft server 6 GB RAM to use, with Minecraft version 1.16.5 and Forge version 36.2.23 it would look like this:
echo OFF
:start
java -Xmx6G -jar forge-1.16.5-36.2.23.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
Last, we have to feed the configuration file named auto_restart-server.toml. It is located in the world\serverconfig directory in the installation directory of your server. In our example, is in the directory "C:\servers\Minecraft Server\world\serverconfig".
In the config file, we have to set use_external_restart_script to true;
In our example, it would look like this:
#Options for restarting:
[restart]
#Is the server started by an external restart script?
use_external_restart_script = true
#Command that is executed on Server stopped to restart the server. Only called if "[restart, use_external_restart_script]" is false.
restart_command = ""
Now we can start the Minecraft server and the Minecraft server restarts, if you use the /restart command.
After testing that the Minecraft server can restart, we continue configuring the features of the Auto Restart mod, starting with the mod naming Auto Restart feature.
Auto Restart Feature