I am trying to create a new tmux session and execute the command 'vagrant up'. 'Vagrant up' takes more than 3 hours so I want to detach the session so that I can come back later and check the status of that command by attaching back to the same session.
I followed the answer specified in the StackOverflow post to accomplish the same.
I am getting the error no session found
. Here is my code:
$cat tmux_sh.sh
#!/bin/bash
echo "step 1"
tmux new-session -d -s rtb123 'vagrant up'
echo "step 2"
tmux detach -s rtb123
$./tmux_sh.sh
step 1
step 2
session not found: rtb123
Start a shell, and send vagrant up to it, so you can see the errors.
The
C-m
means hit return.You are using the
-d
switch when creating the session. This means that the session will start detached, so you don't need to use the detach command. Besides, if your session is not running when you try to detach, it means that it no longer exists, so your command probably exited.