Last active
August 29, 2015 14:05
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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