0

I am trying to make a minecraft server for a while and I have a little problem with a stop script. My startup script ( i want to mention in , just in case of something ) looks like this:

 #!/bin/sh

 screen -S server java -Xms2G -Xmx2G -XX:+UseConcMarkSweepGC -jar spigot.jar

And my stop script:

#!/bin/sh 
screen -r server stop

Now , the problem is that this script is just accessing the screen without executing that command. I don't want to access the screen then type the "stop" command to stop the server (I mean I don't want to do that myself ) . I want a script which can reattach to my detached screen and execute that command for me. Can you find a solution, please? Oh yeah , and I know it's not important but I want to mention that I am using Spigot 1.12.2

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Michael
  • 29
  • 5

1 Answers1

0

Maybe you can run the command server stop in another script:

#!/bin/sh

screen -r ./Script.sh

------------------------------------

#./Sript.sh
#!/bin/sh

server stop
Matzy
  • 353
  • 2
  • 8
  • thanks for trying but it keeps saying the same error , i mean it doesn't execute the command in that screen , it's just executing in the terminal. – Michael Dec 27 '17 at 10:50