4

I use Byobu on a Vagrant dev machine to run multiple things in one screen and to be able to suspend/restore the machine and continue where I left off the other day.

There are times when I have to recreate the machine and setting up 8+ Byobu windows with changing their names, changing to particular directories in each; not to mention running commands in them after setup.

Is there a way one could create a config file or throw in a bunch of commands that does the initial setup so I do not have to spend 5 minutes with that?

There is a currently non working example on Commandlinefu, so I believe it could be done. Anyone have some up to date info how can this be achieved?

byobu version 5.74 (and possibly 5.60 too)
tmux 1.8
Ikon
  • 145
  • 1
  • 7
  • 2
    I am sorry to ask but why is a system administration question like this is not fitting the scope of this site? Could you elaborate on that, please? – Ikon Oct 17 '14 at 08:24

1 Answers1

5

When using tmux, you can write a setup script using shell, like this:

byobu-tmux new-session -d vim
byobu-tmux new-window bc
byobu-tmux new-window bash
byobu-tmux new-window sh

The new session will be run in the background. If you want to attach to the new session right after it was created, add

byobu-tmux attach

in the end. You can even add these commands to your .profile

If you use byoubu with screen, you can describe the desired commands in an alternative configuration file:

screen bc
screen bash
screen sh
Ikon
  • 145
  • 1
  • 7
minaev
  • 1,549
  • 12
  • 13
  • It seemed ok, but then it is still a plain tmux session and I cannot use Byobu keys in it - I prefer the F* keys. Any idea how to really transform it into a "native" Byobu session? I have created a gist to show my version: https://gist.github.com/cda46cee51acc590b8da.git – Ikon Oct 17 '14 at 08:19
  • Have you tried to replace `tmux` with `byobu-tmux` in the startup script? – minaev Oct 17 '14 at 11:42
  • Do you mean when I am creating the tmux windows I should use the byobu-tmux command instead? I will try and get back to you. very soon. – Ikon Oct 19 '14 at 08:22
  • Yes that prefixed "byobu-tmux" version is working the true way. Thanks again! :) – Ikon Oct 20 '14 at 08:16