Setting up server to restart on crash

What’s the easiest to set up a server to restart after a crash? Is it possible from the web ui?

This is not possible from the webui because I can’t think of any way that (ordinarily) a user could tell whether a server crashed.

Checking if the server is up isn’t enough, in my opinion, because what’s the difference between ‘not up’ because it crashed, or ‘not up’ because it was deliberately taken down.

There are many ways people have tried to approach this–and they have varying levels of success for their own needs, but as there is no single answer for all users, it isn’t included as part of MineOS functionality.

Some ways people handle this outside MineOS:

  1. run a shell script that runs Minecraft in a loop. If it closes, it is relaunched again. (Realistically, this also means the server can never be taken down except by killing the calling process from terminal)

  2. run a cron job that checks if Minecraft is running on a port. If it’s not, launch it

Some ways people handle this within MineOS:

  1. run a cron job that checks if Minecraft is up. If it’s not, launch it. (this has the same downside as the previous #1 where it can’t tell whether you stopped it deliberately or if it crashed, but for people who think they want it up all the time, this works). The cron job subsequently has to be turned off before turning off the server for maintenance, updates, etc.

Could you provide some details on the “within MineOS” approach you mention here? That sounds like the exact functionality I’m looking for but I’m not really familiar enough with cron jobs to know how to best implement this. My best guess is running the “start” command every minute (assuming the start command only works when the server is down). Any help with this is greatly appreciated, thanks for your time.

Yes, the start command can be executed as frequently as you like, and if it is already up, it will simply be ignored.

Cool. Well that sounds like a pretty simple solution after all. I’m sure the players on my server will be excited to hear that if they crash the server in the middle of the night they’ll no longer have to wait for me to wake up for it to be rebooted. Thanks for the quick reply!