gpt4 book ai didi

python - 如何使用多个窗口自动化 GNU screen

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:58:25 26 4
gpt4 key购买 nike

我在 screen 的每个窗口上都有多项任务要完成。我需要用一些简单的脚本来自动化它。对此的任何帮助将不胜感激。

               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.

最佳答案

我从 screen 手册页中了解到,我们可以使用带有 -X 开关的 screen 向特定 screen 和窗口发送命令。

  '-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`

关于python - 如何使用多个窗口自动化 GNU screen ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23306806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com