krkr
12/14/2013 - 4:56 PM

Launch grunt, sbt, mongo, nginx, git status, ... in tmux with windows split

Launch grunt, sbt, mongo, nginx, git status, ... in tmux with windows split

#!/bin/bash

name=$1

# ...
cd $name

tmux new-session -s "$name" -d

tmux new-window -t "$name:1" -n 'grunt'
tmux send-keys -t "$name:1" 'cd $name-front; sleep 5; grunt server' C-m

tmux split -h -p 60 -t "$name:1"
tmux send-keys -t "$name:1" 'cd $name-server/server; sbt "~; container:start; container:reload /"' C-m

tmux new-window -t "$name:2" -n 'git'
tmux send-keys -t "$name:2" 'cd $name-front; git status; rn' C-m

tmux split -v -p 50 -t "$name:2"
tmux send-keys -t "$name:2" 'cd $name-server/server; git status; b start mongo' C-m

tmux select-window -t "$name:1"
tmux -2 attach-session -t "$name"