[英]How to automate GNU screen with multiple windows
我在屏幕的每个窗口上都有多项任务要做。 我需要使用一些简单的脚本使其自动化。 任何帮助,将不胜感激。
Start a Screen named "XYZ" with window "1"
Start a another window "2"
Run a particular command on the window "1"
Run a particular command on the window "2"
This can continue for multiple windows,
needed simple API's to achieve this.
我从屏幕手册页中了解到,我们可以使用带有-X
开关的屏幕将命令发送到特定的屏幕和窗口。
'-X' - Send the specified command to a running screen session.
You can use the -d or -r option to tell screen to look only for attached or
detached screen sessions. Note that this command doesn't work if the session
is password protected.'
Source: http://www.gnu.org/software/screen/manual/screen.html
我刚刚将screen命令包装在python API中,因此只需编写python脚本即可完成我的工作。
For creating a screen, creating a window and then sending commands.
`https://github.com/innosam/screenapi`
好吧,您可以尝试如下操作:
# Default screens
screen -t shell1 0
screen -t shell2 1
screen -t server 2 ssh me@myserver
请参阅此redhat指南以了解GNU屏幕
希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.