1

I wrote a simple script to launch two minecraft servers through screen. I can run it fine, but the issue is it hits the first command and runs that line fine, but it then enters the screen it creates and goes to the server without ever launching the second line. How can I force it to launch both commands?

Here is the script:

#!/bin/bash
#Launches minecraft servers

#Plugin Test Server
screen -S PluginTest java -Xms1024M -Xmx1024M -XX:MaxPermSize=128M -jar /home/kalenpw/TestWorld/spigot-1.10.jar

#Khalidor Server
screen -S Khalidor java -Xms8192M -Xmx9216M -XX:MaxPermSize=128M -jar /home/kalenpw/KhalidorServer/spigot-1.10.jar

What happens is the first PluginTest runs fine, but the second line for Khalidor never runs.

3

If you add '&' to the end of the first command it will allow the second command to run. So change the first command to:

screen -S PluginTest java -Xms1024M -Xmx1024M -XX:MaxPermSize=128M -jar /home/kalenpw/TestWorld/spigot-1.10.jar &

The '&' causes the command to be run in the background. If you add one to the end of the second command as well you will be returned to a prompt after running your script, and both of your commands will be running in the background. You will be able to see them by running the 'jobs' command.

  • Now when I run it I get Must be connected to a terminal I think this is because I'm connected over ssh, however – kalenpw Sep 2 '16 at 21:53

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.