By starting a new tmux session and disconnecting it, everything inside the shell script

I am trying to create a new tmux session and run the 'vagrant up' command. "Vagrant up" takes more than 3 hours, so I want to disconnect the session in order to return later and check the status of this command, returning to the same session.

I have followed the answer indicated in the message https://stackoverflow.com/a/166648/16 to do the same.

I get an error message 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
+4
source share
2 answers

Launch the shell and send it to the firewall so you can see the errors.

tmux new-session -d -s rbt123
tmux send-keys vagrant up C-m
tmux detach -s rtb123

C-m means return to click.

+5

-d. , , . , , , , , , , .

+5

Source: https://habr.com/ru/post/1613744/


All Articles