Skip to content

Instantly share code, notes, and snippets.

@nicewook
Created October 18, 2017 06:26
Show Gist options
  • Save nicewook/eb467fed5c71fe7b0ff35168b4ed6cd6 to your computer and use it in GitHub Desktop.
Save nicewook/eb467fed5c71fe7b0ff35168b4ed6cd6 to your computer and use it in GitHub Desktop.
#!/bin/bash
#this is for tmux session initialize set script
SESSION_NAME="spacosa"
# check if session already exist
if(tmux has-session -t $SESSION_NAME 2> /dev/null); then
echo "Session $SESSION_NAME exists"
else
echo "Session $SESSION_NAME not exist. Create one"
tmux -2 new-session -s ${SESSION_NAME} -d # -2 means 256 color
tmux split-window -h -p 60 -t ${SESSION_NAME} # Left 4 : Right 6
# Right vertically divide to 5 pane
tmux split-window -v -p 80 -t ${SESSION_NAME}
tmux split-window -v -p 75 -t ${SESSION_NAME}
tmux split-window -v -p 67 -t ${SESSION_NAME}
tmux split-window -v -p 50 -t ${SESSION_NAME}
tmux select-pane -L # go back to Left
#Left vertically divide to 4 pane
tmux split-window -v -p 75 -t ${SESSION_NAME}
tmux split-window -v -p 67 -t ${SESSION_NAME}
tmux split-window -v -p 50 -t ${SESSION_NAME}
tmux select-pane -t 4 # go to right top pane
tmux split-window -h -p 50 -t ${SESSION_NAME} # horizontally divide to 2 pane
tmux select-pane -D
tmux split-window -h -p 50 -t ${SESSION_NAME} # horizontally divide to 2 pane
tmux select-pane -D
tmux split-window -h -p 50 -t ${SESSION_NAME} # horizontally divide to 2 pane
tmux select-pane -D
tmux split-window -h -p 50 -t ${SESSION_NAME} # horizontally divide to 2 pane
# go to specific pane and do ssh connect
tmux select-pane -t 0
tmux send-keys "ssh 111.222.333.66" "Enter"
tmux select-pane -t 1
tmux send-keys "ssh 111.222.333.65" "Enter"
tmux select-pane -t 2
tmux send-keys "ssh 111.222.333.59" "Enter"
tmux select-pane -t 3
tmux send-keys "ssh 111.222.333.52" "Enter"
tmux select-pane -t 4
tmux send-keys "ssh 111.222.333.60" "Enter"
tmux select-pane -t 6
tmux send-keys "ssh 111.222.333.61" "Enter"
tmux select-pane -t 8
tmux send-keys "ssh 111.222.333.62" "Enter"
tmux select-pane -t 10
tmux send-keys "ssh 111.222.333.63" "Enter"
tmux select-pane -t 5
tmux send-keys "ssh 111.222.333.55" "Enter"
tmux select-pane -t 7
tmux send-keys "ssh 111.222.333.56" "Enter"
tmux select-pane -t 9
tmux send-keys "ssh 111.222.333.57" "Enter"
tmux select-pane -t 11
tmux send-keys "ssh 111.222.333.58" "Enter"
tmux select-pane -t 12
tmux send-keys "ssh 111.222.333.73" "Enter"
fi
tmux ls
tmux -2 attach-session -t ${SESSION_NAME} # attach session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment