本文介绍了sh screen-等待屏幕终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在写一个确实向运行中的屏幕会话发送命令的小脚本.此命令将停止屏幕,但不会立即停止.我需要等待它完成才能继续执行脚本的其余部分.
I'm writing on a little script that does send a command to a running screen session. This command stops the screen but not instantly. I need to wait for it to finish in order to continue with the rest of the script.
这是我停止屏幕的方式:
This is how I stop the screen:
screen -S $SCREEN_NAME -p 0 -X stuff "`printf "stop\r"`"
我该怎么办?
推荐答案
我找到了解决方案:
您只需检查屏幕是否仍在运行,然后等待(sleep
)一秒钟.
You just simply check if the screen is still running and wait (sleep
) for one second.
赞:
while screen -list | grep -q $SCREEN_NAME
do
sleep 1
done
这篇关于sh screen-等待屏幕终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!