I have a Minecraft server that I start over ssh. I use screen so it keeps running

Spigot allows you to set a start script so that if the server stops it can start again automatically.

I currently have the following code for my spigot start command (this is inside a shell file that spigot runs)

screen -s minecraft -x ~/path/to/server/start.sh

then in my start.sh file I have the following

java -Xmx1500m -jar server.jar -nogui

before I started with the restart I would ssh into the computer, start screen then run the start.sh file. But now I need a file that will start screen and run the start.sh file

How do I do this?

  • You don't need to use screen or scripts at all. Minecraft Server runs quite happily as a systemd service, with all the systemd settings, benefits, and options. – user535733 Apr 3 at 0:22
-X            Execute <cmd> as a screen command in the specified session.
-x            Attach to a not detached screen. (Multi display mode).

what i did was see the -X flag and made 2 mistakes the first was to use lowercase x not an uppercase X

the second was that you don't need the -X flag, and you can just use

screen -s minecraft ~/path/to/the/start.sh

and give the command or file as an argument without the flag

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.