How to resume processes after reboot

~/.wazarc is executed every time terminal is launched. My .wazarc is the below.

# execute tmux
[ -z "$TMUX"  ] && \. "$HOME/"
# run elastic search
cd /tmp && sudo /usr/share/elasticsearch/bin/elasticsearch -Des.insecure.allow.root=true &
# run redis
cd /tmp && redis-server &

As you can see, I bring up tmux, Elasticsearch, and Redis for my (current) project.

I'm using tmux and it has modules to save/restore sessions, called tmux-resurrect. Here is may `.tmuxrc`

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# restore sessions
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-processes '"~rails c" "~rails s"' # add rails
set -g @resurrect-strategy-nvim 'session'
if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'

Just for reference, is below. (I do send-keys to restore here)



tmux has-session -t $session 2>/dev/null
if [ "$?" -eq 1 ] ; then
  # set up tmux
  tmux start-server
  # create a new tmux session, starting vim from a saved session in the new window
  tmux -u new-session -d -s $session 

  # restore
  tmux send-keys -t $session cd /home/shohey1226/.tmux/plugins/tmux-resurrect/scripts/ && /home/shohey1226/.tmux/plugins/tmux-resurrect/scripts/ enter
  echo "session found. connecting..."
#tmux attach-session -t $session