OPTIONS="java -Xms1024M -Xmx1024M -jar craftbukkit.jar"
PROCESS=server01
screen -dmS $PROCESS $OPTIONS nogui # Starting the application
screen -x $PROCESS -X stuff `printf "stop\r"` # Closing the application
screen -x $PROCESS # Attaching to the terminal of the application
The application works fine at the start, however I get problems with stuff 'printf "stop/r"'
It seems not to work when I just start up, wait some time and then try to stop it with the command above. But the strange thing is, that if I did screen -x $PROCESS
and detach (ctrl-A & ctrl-D
) and then I use the Stop
command it does work. So is there a way around to stuff printf
without screen -x $PROCESS
?
Adding the argument -p 0 should fix it. Something like this:
screen -x $PROCESS -p 0 -X stuff `printf "stop\r"`
(From screen documentation: -p window Preselect the named window if it exists.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With