Byobu(如GNU Screen)启动脚本

时间:2018-06-26 03:05:55

标签: bash scripting gnu-screen byobu

我使用Byobu作为基于文本的窗口管理器和终端多路复用器(Byobu与GNU Screen非常相似)。

我想要一个bash脚本来初始化一些窗口。

我已经阅读了此答案shell script for byobu commands和此网页http://perspectiveunspoken.com/2015/08/a-startup-script-for-byobu/,并根据以下内容尝试制作了自己的版本。

首先,我使用PuTTY将ssh切换到VM,然后从主目录运行脚本。

byobu -S "ddnenv"
echo -e "A"
if [ -z "$(byobu list-sessions | grep ddnenv)" ]
 then
 echo -e "B"
 byobu-tmux new-session -d -t ddnenv # creates a new detached Byobu session
 byobu rename-window  'ddn-deploy'
 byobu send-keys -t 0 "/a/b/c/bigcountry-twisted/deployutils/" C-m
 byobu send-keys -t 0 "workon py3twstd" C-m
 #Server window
 byobu new-window
 byobu rename-window 'ddn-server'
 byobu send-keys -t 1 "/a/b/c/bigcountry-twisted/" C-m
 byobu send-keys -t 1 "./server.sh" C-m
 #App root for build
 byobu new-window
 byobu rename-window 'ddn-build'
 byobu send-keys -t 2 "/a/b/c/bigcountry/" C-m
 byobu send-keys -t 2 "nvm use stable" C-m
 #App within root for edit
 byobu new-window
 byobu rename-window 'ddn-edit'
 byobu send-keys -t 3 "/a/b/c/bigcountry/app" C-m
 byobu send-keys -t 3 "nvm use stable" C-m
fi
echo -e "C"
# Enter Byobu
byobu-tmux attach -t ddnenv
echo -e "D"

脚本启动byobu,创建第一个窗口,然后停止。从创建的唯一窗口“退出”时,您将看到此输出

A
failed to connect to server
B
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
failed to connect to server
C
session not found: ddnenv
D

关于我在做什么错的任何建议?

0 个答案:

没有答案