tmux-plugins / tmux-continuum

Continuous saving of tmux environment. Automatic restore when tmux is started. Automatic tmux start when computer is turned on.
MIT License
3.31k stars 149 forks source link

Is it possible to add a running script to resurrect-processes list and automatically restore it? #104

Closed ioogithub closed 2 years ago

ioogithub commented 2 years ago

I have a script running in a bash shell. I would like to add the script name to the list of ressurrect-process list so that when I run the script, save the session then auto restore, the script will start again and continue running, just like the binary apps like tail for example.

Here is what I am trying to do:

  1. Run ~/script.sh in a tmux pane
  2. Save session
  3. prefix + b d to detach from the session 5 tmux kill-server

In my ~/.tmux/Session/tmux_resurrect_dt.txt file I see: pane host 1 1 :* 3 :/home/user 0 bash :/bin/bash /home/user/script.sh

Restart tmux

The session is restored however the script is not started. Instead I just get a command prompt. I have any other binary processes running they are restored but any scripts are not.

In the ~/.tmux file I tried many variations of the script name: set -g @resurrect-processes 'script script.sh "~/script.sh /bin/bash /home/user/script.sh"

none of these options work. Is is possible for continuum to auto restore a session with running scripts or can only binary files be restored in this way?

bruno- commented 2 years ago

Yes, this is possible, you just have to figure out the correct value for set -g @resurrect-processes. Try maybe set -g @resurrect-processes '~script.sh'.

The instructions are here: https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_programs.md If something in the docs is not clear, consider opening a PR when you figure it out.