Skip to content

Instantly share code, notes, and snippets.

@mengstr
Created August 23, 2011 04:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mengstr/1164361 to your computer and use it in GitHub Desktop.
Save mengstr/1164361 to your computer and use it in GitHub Desktop.
Open some tmux windows/panes and start apps in them
#!/bin/bash
SESSION=$USER
# if the session is already running, just attach to it.
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
tmux attach -t $SESSION
exit 0;
fi
tmux set-window-option -t $SESSION -g automatic-rename off
tmux -u new-session -d -s $SESSION
tmux send-keys -t $SESSION:0 'cd via/' C-m
tmux new-window -t $SESSION:1 -n constatus
tmux send-keys -t $SESSION:1 'cd via/constatus/; ./start.sh' C-m
tmux new-window -t $SESSION:2 -n frontend
tmux send-keys -t $SESSION:2 'cd via/frontend/; ./start.sh' C-m
tmux new-window -t $SESSION:3 -n test
tmux select-window -t $SESSION:3
tmux split-window -h
tmux split-window -v
tmux send-keys -t $SESSION:3.0 'cd via/test/; supervisor f.js' C-m
tmux send-keys -t $SESSION:3.1 'cd via/test/' C-m
tmux send-keys -t $SESSION:3.1 'telnet localhost '
tmux send-keys -t $SESSION:3.2 'cd via/test/' C-m
tmux send-keys -t $SESSION:3.2 'telnet localhost '
tmux -2 -u attach -t $SESSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment