Start Server Inside Screen with Shell File

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)

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

then in my start.sh file I have the following

#!/bin/sh
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?

1

1 Answer

-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

Your Answer

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

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest