Auto-restart on server crash / startup script

Hello,

I just have a question, hopefully I’m not overthinking this. Spigot has a built-in function to auto-restart the server upon a crash. Its only argument is the location of a .sh file. My question is, does the start button in the web UI use any specific script, or does it simply execute the basic commands (plus extra specified arguments), such as

java -Xms4G -jar spigot-1.12.jar

etc? If that’s the case, I can simply write a .sh file with the same arguments and have Spigot.yml point to that. That’s all I need to know and I can take care of the rest.

Thank you!!

When you hit ‘start’ in the webui, it invokes java directly, e.g., java [add'l args] --jar spigot-1.212.jar, but within an instance of screen, which is a way to let the process be detached from the webui (so the game process and the webui process aren’t bound to eachother).

The webui only knows how to work with servers that are in named screen instances, though. So if you wanted to have a .sh script open up a webui-usable server, you should make sure the script starts the server via MineOS commands:

#!/bin/bash
cd /usr/games/minecraft
./mineos_console.js -s servername start

Excellent info! I’ll play with it this weekend. Thanks so much.

I have a question in the same range… I found a few scripts that seem to do what I want but it appears messy (pic)
( tried to upload a pic but not sure it worked)

If it didn’t upload then the jist is I have ~20 PID’s now all for the java running the server it seems.
this script might not be working like I think it should be and looking for input.

https://pastebin.com/YdWmn3ZM (start.sh)
https://pastebin.com/qduHTh7x (waitandrun.sh)

Is this more complicated than it really needs to be? It seems like the crashed server might not be unloading as I think it should… but I’m also not terribly adept at linux either.

The problem here is actually just that the python version of the scripts didn’t have the ‘is the server up?’ checks that the Node.js version does.

Therefore, each execution of mineos_console.py for starting the server will start a new server. It’s probably quite fixable, but I haven’t touched the python codebase in years…