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这个应用程序一开始运行得很好,但是我的stuff 'printf "stop/r"'遇到了问题,当我刚启动的时候,它似乎不能工作,等待一段时间,然后尝试用上面的命令停止它。但奇怪的是,如果我执行了screen -x $PROCESS和detach (ctrl-A & ctrl-D),然后使用Stop命令,它就可以工作。那么,有没有办法在没有screen -x $PROCESS的情况下使用stuff printf呢
发布于 2012-12-14 08:01:41
添加参数-p 0应该可以修复它。如下所示:
screen -x $PROCESS -p 0 -X stuff `printf "stop\r"`(从screen documentation:-p window预先选择命名窗口(如果存在)。)
https://stackoverflow.com/questions/13829310
复制相似问题