juanignaciosl
10/10/2014 - 3:54 PM

tmux cartodb workspace

tmux cartodb workspace

#!/bin/bash

SESSIONNAME="cartodb_workspace"
tmux has-session -t $SESSIONNAME &> /dev/null

if [ "$?" != "0" ]; then
  tmux new-session -s $SESSIONNAME -n script -d
  tmux split-window -h -t $SESSIONNAME -t 0
  tmux split-window -h -t $SESSIONNAME -t 1
  tmux split-window -v -t $SESSIONNAME -t 0
  tmux split-window -v -t $SESSIONNAME -t 1
  tmux split-window -v -t $SESSIONNAME -t 2
  tmux split-window -v -t $SESSIONNAME -t 2
  tmux send-keys -t 0 "cd /vagrant && bundle exec rails s -p 3000" C-m
  tmux send-keys -t 3 "cd /cartodb-central && bundle exec rails s -p 4000" C-m
  tmux send-keys -t 6 "cd /vagrant && redis-server" C-m
  tmux send-keys -t 1 "cd /vagrant && bundle exec script/resque" C-m
  tmux send-keys -t 4 "cd /cartodb-central && bundle exec script/resque" C-m
  tmux send-keys -t 2 "cd /Windshaft-cartodb && node app.js development" C-m
  tmux send-keys -t 5 "cd /CartoDB-SQL-API; node app.js development" C-m
fi

tmux attach -t $SESSIONNAME