Skip to content

Simple Instructions: 1.3 Setup (MC 1.17.1 or newer, Linux, Start Script)

GeheimagentNr1 edited this page Jan 10, 2022 · 2 revisions

In this example, we suppose, that you installed the Minecraft server in the directory "/opt/minecraft/servers/Minecraft Server/" and use the Minecraft version 1.18.1 and the Forge version 39.0.17.

First, you create a file named start.sh in the "/opt/minecraft/servers/Minecraft Server/" directory.
Next, you insert the start script into the start.sh file:

bash -c 'cd <Path of your Minecraft server>; screen -d -m -S <Name of your Screen, i.e. your directorys name without spaces> java -Xmx<Amount of RAM in gigatytes you want to allocate to Minecraft>G @libraries/net/minecraftforge/forge/<Minecraft version>-<Forge version>/unix_args.txt

In our example we give the Minecraft server 6 GB RAM to use, with the directory "/opt/minecraft/servers/Minecraft Server/", Minecraft version 1.18.1 and Forge version 39.0.17 it would look like this:

bash -c 'cd /opt/minecraft/servers/Minecraft Server/; screen -d -m -S MinecraftServer java -Xmx6G @libraries/net/minecraftforge/forge/1.18.1-39.0.17/unix_args.txt

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 "/opt/minecraft/servers/Minecraft Server/world/serverconfig".
In the config file, we have to set use_external_restart_script to false and restart_command to "<Path of your Minecraft server>/start.sh".

#Options for restarting:
[restart]
	#Is the server started by an external restart script?
	use_external_restart_script = false
	#Command that is executed on Server stopped to restart the server. Only called if "[restart, use_external_restart_script]" is false.
	restart_command =  "<Path of your Minecraft server>/start.sh"

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 = false
	#Command that is executed on Server stopped to restart the server. Only called if "[restart, use_external_restart_script]" is false.
	restart_command =  "/opt/minecraft/servers/Minecraft Server/start.sh"

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

Home (Overview)

How to set up the mod?

Setup Guide

Versions

Scripts

Changelogs

Download

Clone this wiki locally