0

I use tmux for a program I run that sometimes crashes, so I can collect errors from it. I use this method of error collection for a few different programs and would like to know if there's a programmatic way of creating multiple tmux sessions with bash, each having their own name and having a command ran in them.

I have tried doing the following:

tmux new -ds "myname" "my command"
tmux new -ds "myname2" "my command"

however, if the program or command in the tmux session finishes/closes/crashes the tmux session is automatically exited and closed, defeating the purpose of trying to get error output.

1 Answer 1

1

You have to make the command not exit. Ex. run the shell after the command, so the shell will wait for you:

tmux new -d -s my-session 'sh -c "my command; sh"'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.