问题描述
我已经使用屏幕启动了服务器进程,后来我可以根据需要附加到屏幕上,然后再次分离以进行其他操作.它工作正常,但我最近发现了byobu,我真的很喜欢它.
I have used screen to start a server process, to witch I can later attach if needed and deatach again to carry on with other things. It worked fine but I have found byobu recently and I really love it.
我想使用相同类型的脚本来运行服务器,但我希望将其附加到byobu选项卡上,而不是屏幕sesson.
I want to use the same kind of scripts to run the server but instead of a screen sesson I would like to attach it to a byobu tab.
我正在使用byobu-tmux(因为它看起来更好).我该怎么办?
I'm using byobu-tmux (because it looks better). How could I do it?
我的原始脚本(它们都做得更多,但这是相关的部分):
My original scripts (they both do more, but these are the relevant parts):
# Startup
screen -a -dmS <name> <command>
# Attach
screen -x <name>
我正在使用Ubuntu服务器16.04
I'm using Ubuntu server 16.04
推荐答案
我不知道screen
命令,因此这里是byobu
的快速示例命令:
I don't know screen
commands, so here is a quick sample commands for byobu
:
要在当前会话中创建新的标签页(称为屏幕),您可以:
To create new tabs (called screens) inside the current session you can:
byobu new-window "ls -la && sleep 5"
要使用命令开始新的会话(您可以附加到新的byobu实例),您可以:
To start a new session (new byobu instance you can attach to) with a command you can:
byobu new-session -s "session name" "ls -la && sleep 5"
要创建已分离的
byobu new-session -d -s "session name" "ls -la && sleep 5"
按名称附加到会话:
byobu attach -t "session name"
这篇关于在byobu选项卡中启动命令的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!