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
并分离(ctrl-A & ctrl-D
),然后使用Stop
命令,它就可以工作。因此,有没有一种方法可以绕过screen -x $PROCESS
而使用stuff printf
呢?
screen -x $PROCESS -X "stuff \
printf 'stop\r'`"`。 - twalberg