Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script to start command in byobu tab

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

like image 237
P. Károlyi Avatar asked Mar 11 '26 07:03

P. Károlyi


1 Answers

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"
like image 77
bogdan.mustiata Avatar answered Mar 14 '26 02:03

bogdan.mustiata