Skip to content

Instantly share code, notes, and snippets.

@danielboggs
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielboggs/e3f5c807f412296cdf68 to your computer and use it in GitHub Desktop.
Save danielboggs/e3f5c807f412296cdf68 to your computer and use it in GitHub Desktop.
Simple shell script to start up a new tmux session for Rails app development.
#!/bin/bash
DIR=PATH_TO_PROJECT
SESSION=SESSION_NAME
if tmux attach -t $SESSION; then
echo "Attaching to tmux session: $SESSION"
else
echo "Building new tmux session: $SESSION"
cd $DIR
tmux -2 new-session -d -s $SESSION
tmux new-window -t $SESSION:1 -n 'code'
tmux select-window -t $SESSION:1
tmux send-keys "vim" C-m
tmux new-window -t $SESSION:2 -n 'server'
tmux select-window -t $SESSION:2
tmux send-keys "foreman start" C-m
tmux select-window -t $SESSION:0
tmux -2 attach-session -t $SESSION
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment