Created
October 4, 2011 04:28
-
-
Save persson/1260906 to your computer and use it in GitHub Desktop.
tmux script to create single local tmux session attached to many remote tmux sessions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Yes, there is no six | |
hosts=(pipe1 pipe2 pipe3 pipe4 pipe5 pipe7 pipe8 pipe9) | |
names=(pipe1 pipe2 pipe3 pipe4 pipe5 pipe7 pipe8 pipe9) | |
sessions=(1 2 3 4 5 7 8 9) | |
tmux new-session -d -s pipelines | |
i=0 | |
while [ $i -lt $((${#hosts[@]})) ]; | |
do | |
#FIXME: check to see if window exists to avoid tmux warnings when 'reattaching' | |
tmux new-window -t pipelines:${sessions[$i]} \ | |
-n ${names[$i]} \ | |
"ssh someuser@${hosts[$i]}.somewhere.com -t 'tmux attach-session -t ${USER}-remote || tmux new-session -s ${USER}-remote'" | |
i=$((i+1)) | |
done | |
tmux kill-window -t pipelines:0 | |
tmux attach -t pipelines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment