A basic startup script for minecraft-server
- This script has been tested on Amazon Linux AMI but should work on any Red Hat Enterprise Linux (RHEL) compatible distro, eg: CentOS
- You should have minecraft-server installed in
WORKDIR
(default:/usr/local/minecraft-server
)
- Simply drop the
minecraft-server
file into/etc/init.d
- Adjust the following variables at the top of the file to match your system's capabilities:
WORKDIR
- path where minecraft-server is installedMIN_MEMORY_ALLOCATION
- Initial memory allocation pool for JVMMAX_MEMORY_ALLOCATION
- Maximum memory allocation pool for JVM
- Start Minecraft Server:
service minecraft-server start
- Stop Minecraft Server:
service minecraft-server stop
- Restart Minecraft Server:
service minecraft-server restart
- Get Minecraft Server Status:
service minecraft-server status
- The service will start in the background and ignore the HUP signal.
- stderr/stdout will be routed to
$WORKDIR/service.log
[TODO]
See https://minecraft.gamepedia.com/Tutorials/Setting_up_a_server#Linux_instructions
Assuming you already have Minecraft Server installed, you can easily upgrade to a new version like so:
wget https://launcher.mojang.com/mc/game/X.YY.Z/server/abcdefg12345/server.jar -O /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar
chown minecraft-server.daemon /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar
ln -sf /usr/local/minecraft-server/minecraft_server.X.YY.Z.jar server.jar
service minecraft-server restart