How to make a Minecraft Server exit automatically when it crashes

How to make a Minecraft Server exit automatically when it crashes - Stylish young ethnic woman going through metro entrance gate

I am setting up a custom modded server and am running into an issue. During all the block id related crashes, the server jar will still be running even though it crashed. I would like it to quit when it crashes, so I can reboot it easier.

Preferably this would be some option I could stick in my startup script which is

\#\!/bin/bash  
cd "$(dirname "$0")"  
exec java -Xmx1G -Xms1G -jar forge.jar nogui

Thanks in advance



Best Answer

The general idea of an auto shutdown/ auto restart script is that the script needs to know when the server crashes. This can often be done by just having the script listen for certain lines of code or perhaps issuing a list command and wait for its response. I however do not know mac/linux scripts and thus cannot help you there. However i can refer you to alternatives.

One such alternative is Multicraft. It is a server wrapper and provides a web admin panel to remotely manage your server. A built in feature would be the auto-restart after crash function. The server wrapper will constantly ping the server and wait for a response and after a set period of inactivity, restart the server. It also recognises common crash console outputs and reboot the server after crash. Another much simplier alternative is McMyAdmin which also contain an auto-restart function.

A note to the above 2 server wrappers. They both have a free version as well as a paid version. If you are running a server for a couple friends the free version will do fine as it allow for 10 and 8 players to join respectively. If you need more than that, then you can look into the paid options.

Links to both of the server wrapper

http://www.multicraft.org/

http://www.mcmyadmin.com/




Pictures about "How to make a Minecraft Server exit automatically when it crashes"

How to make a Minecraft Server exit automatically when it crashes - Calm Muslim woman with copybook wearing floral headscarf wearing jeans jacket with backpack entering subway station through automatic turnstile
How to make a Minecraft Server exit automatically when it crashes - Free stock photo of building, business, city
How to make a Minecraft Server exit automatically when it crashes - Close Up Photo of Programming of Codes



How do I make Minecraft server restart automatically?

The /stop command is a server command that stops a Minecraft server and then saves all of the server data such as players, worlds, chunks for the Overworld, chunks for the Nether and chunks for the End.

How do I turn my Minecraft server off?

A sign of a server crash is a "Saving chunks" or "Shutting down internal server" screen. The most common cause of crashes are mods, preexisting bugs, and updates. Attempting to modify the files of Minecraft or individual worlds, even with advanced editors, can also cause crashes.

Can you crash a Minecraft server?

Simple utility mod that allows servers (including integrated servers) to pause when all connected clients are paused/on a pauseable screen. You can also configure it to pause servers when there are no clients connected (to save your CPU!) and to send a chat message when the server pauses.



How To Fix Minecraft Forge 1.18.1 Crashing!




More answers regarding how to make a Minecraft Server exit automatically when it crashes

Answer 2

There should be an open app editor in Mac where by you can close opened applications and services, if you launch that you should be able to close the Java service or anything related, but I am afraid I do not know how to do this automagically.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Ono Kosuki, Keira Burton, Dávid Lehoczki, luis gomes