2

I need a way to immediately restart the main process in a tmux pane after the pane's the process has terminated.

I use byobu-tmux to run various components of a client-server (grails) application that I'm developing. I've written a shell script which opens panes and starts all of the components:

byobu-tmux split-window -h "sleep 10; <client-1-start-script>"
byobu-tmux split-window -t 1 -v -p 66 "sleep 10; <client-2-start-script>"
byobu-tmux split-window -t 2 -v -p 50 "sleep 10; <client-3-start-script>"
byobu-tmux split-window -t 0 -v "<server-start-script>"

This script works but, as you might expect from tmux, whenever you kill one of the pieces it closes that pane. I have also tried to add in a bash wrapper:

byobu-tmux split-window <opts> "<script>; byobu-tmux respawn-pane"

and use an explicit bash environment:

byobu-tmux split-window <opts> "bash -i -c \"<script>\""

This question demonstrates how to keep the pane open, but is there any way to get the command that was executed on creation of the pane to rerun instead of closing the pane?

1 Answer 1

2

Have a look at the commands:

and friends in the run-one package in Ubuntu.

Simply wrap your command with one of those, as appropriate.

Full disclosure: I'm the author of Byobu, as well as the run-one suite of utilities.

1
  • Using byobu-tmux split-window -h "sleep 10; keep-one-running <client-1-start-script> <opt1> <opt2>" works great when using kill command but still closes with CTRL-C. Would it be possible to only have the CTRL-C handled by the client script? Jan 12, 2017 at 18:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .