2

I run Byobu (backed by Tmux) on a remote machine. I have a basic window layout which is what I generally want, and I've configured Byobu to launch at login so when I ssh to the remote machine I resume my session and when I want to leave I F6 to detach and disconnect. This works well.

My problem is when I reboot the machine all my Byobu windows are erased. I'm not trying (yet?) to resume exactly where I left off, but just getting all the windows with their names would be a big help.

I can use .byobu/window.tmux to have a window layout that's executed when I connect. But I've tried this

new-session 'remote';
new-window -n irc;
new-window -n code;
new-window -n logs;

and that causes Byobu to create a new session each time I connect, so I can't resume anymore.

Then I tried adding the -A flag to attach:

new-session -A 'remote';
new-window -n irc;
new-window -n code;
new-window -n logs;

This goes back to resuming the old session, but now every time I connect I get an additional three windows added to the windows I had before.

Here's pseudo-code for what I want:

if session_exists('remote') {
  attach('remote');
} else {
  new-session 'remote';
  new-window -n irc;
  new-window -n code;
  new-window -n logs;
}

Can I do this?

Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99

1 Answers1

2

I found this article where the guy explains how to create one main, unattached session and then create a shared session from that one. This results in the behavior you're aiming for, I believe. Check out this article: byobu-tmux tabbed windows

oneindelijk
  • 606
  • 1
  • 6
  • 18
  • Thanks! That looks really promising. I can't confirm because I gave up on Byobu and switched to plain Tmux, configured to copy basic Byobu behavior. – Nathaniel Waisbrot Nov 29 '21 at 16:33