Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Declare Session Variable
- SESSION="ey"
- function hassession {
- tmux has-session -t ey 2>/dev/null
- }
- # Change to the Webshop 4 Project Dir
- cd /Users/$USER/Projects/webshop4/
- # # Get the servers addresses
- SERVERS=($(ey servers --environment="Production" | awk '{print $1}'))
- SERVERS=("${SERVERS[@]:2}")
- # Create tmux session
- if ! hassession ; then
- echo "Starting new session for ey"
- tmux new -s $SESSION -d
- # Handle first host.
- host=${SERVERS[0]}
- echo "Creating window split for host: $host"
- tmux send-key "ssh deploy@$host" C-m
- tmux send-key "htop" C-m
- unset SERVERS[0]
- # Loop through the other hosts
- for host in "${SERVERS[@]}"
- do
- echo "Creating window split for host: $host"
- tmux split-window -v
- tmux select-layout tiled > /dev/null
- tmux send-key "ssh deploy@$host" C-m
- tmux send-key "htop" C-m
- done
- fi
- tmux attach -t $SESSION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement