Shell Screen -X Stuff problems

Posted by user1621988 on Stack Overflow See other posts from Stack Overflow or by user1621988
Published on 2012-12-11T22:08:14Z Indexed on 2012/12/11 23:03 UTC
Read the original article Hit count: 151

Filed under:
|
|
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

Starting the application work fine, however I got 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 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 the $PROCESS?

Thank You in Advance

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell