Script to start command in byobu tab

痴心易碎 提交于 2020-01-14 03:33:08

问题


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.

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.

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>

I'm using Ubuntu server 16.04


回答1:


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"

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"

To create it already detached:

byobu new-session -d -s "session name" "ls -la && sleep 5"

To attach to a session by name:

byobu attach -t "session name"


来源:https://stackoverflow.com/questions/38435541/script-to-start-command-in-byobu-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!