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?