壳牌GNU屏幕-X东西问题 [英] Shell GNU-Screen -X Stuff problems

查看:198
本文介绍了壳牌GNU屏幕-X东西问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

应用程序工作正常起步,但是我得到的问题东西'printf的停止/ R'
这似乎不工作,当我刚开始时,等待一段时间,然后尝试使用上面的命令停止它。但奇怪的是,如果我做了屏幕-x $ PROCESS 和分离( CTRL-A和CTRL-D ),然后我用它做的工作停止命令。那么,有没有办法绕到东西的printf 没有屏幕-x $ PROCESS

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?

推荐答案

添加参数 -p 0 应该修复它。事情是这样的:

Adding the argument -p 0 should fix it. Something like this:

screen -x $PROCESS -p 0 -X stuff `printf "stop\r"`

(距屏幕的文档:-p窗口preSELECT如果存在指定的窗口)

(From screen documentation: -p window Preselect the named window if it exists.)

这篇关于壳牌GNU屏幕-X东西问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆