I want to write a shell script that does this:
First, create a tmux session
Second, run a ruby script called "run.rb" INSIDE the tmux session
In pseudo-code, what I want to do:
tmux new -s my_session
ruby run.rb # NOTE: I want this to run inside the my_session tmux session.
#!/bin/bash tmux new -s my_session ruby run.rb tmux detach
Create a file named
my_script.sh and give it the above contents.
Make the file executable by running:
chmod 755 my_script.sh
chmod +x my_script.sh
Then run the shell script:
When you perform the
chmod 755 filename command you allow everyone to read and execute the file, and the file owner is allowed to write to the file as well. You may need this for Perl and other scripts that should be run via a webserver. If you apply 755 to a directory, it means that everyone can go to it and get its file listing.
These permissions are usually translated into textual representation of
You can alternatively use
chmod +x file_name on a file to make it executable.
To run the ruby script inside the tmux session:
#!/bin/bash tmux new-session -d -s my_session 'ruby run.rb' tmux detach -s my_session