tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

Restore processes with the same process name but different launch commands

Open ejoubaud opened this issue 10 years ago • 3 comments

Process restoration seems to be based on the process name, but sometimes processes launched with different options will have the same process name, and you may want some of them in different panes.

Example:

  • I run my Rails server in a pane with foreman start web, and my Rails delayed jobs workers in a different pane with foreman start dj.
  • Both processes are named foreman: master, and appear as such in ps and ~/.tmux/resurrect/last
  • In @resurrect-processes, if I add "~foreman->foreman start web", both panes will try to launch my web server, (same problem with "~foreman->foreman start dj")

Would there be a better way to identify the restoration commands than the process name? (not that I can think of anything...)

ejoubaud avatar Sep 25 '15 13:09 ejoubaud

I found a dirty workaround, using sh -c 'command && something':

set -g @resurrect-processes 'vi vim (...) "foreman: master->bundle exec foreman start web" "~foreman start dj->sh -c \"bundle exec foreman start dj && exit\""

It sets a distinct process name but it's not pretty...

ejoubaud avatar Sep 25 '15 13:09 ejoubaud

Hi, I would really like to know if there's a better way to identify commands running in tmux panes.. the "not perfect" process name detection is a known problem. node developers in particular seem to have issues with this.

Thanks for sharing the solution though..

bruno- avatar Sep 25 '15 15:09 bruno-

set -g @resurrect-processes 'vi vim (...) "foreman: master->bundle exec foreman start web" "~foreman start dj->sh -c \"bundle exec foreman start dj && exit\""

Is @ejoubaud way still the best way to auto-relaunch bin/bundle exec foreman start if it's running?

erwin avatar Jul 07 '24 16:07 erwin