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