Skip to content

Instantly share code, notes, and snippets.

@hukl
Last active March 7, 2017 10:33
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 hukl/7907348 to your computer and use it in GitHub Desktop.
Save hukl/7907348 to your computer and use it in GitHub Desktop.
# ZSH Script to open a tmux session for every host passed as CLI argument and synchronizes all the panes.
# Invoke with: ./cluster.zsh user@host1 user@host2 user@host3
#!/bin/zsh
while (( $# != 0 )) {
tmux splitw "ssh $1"
tmux select-layout tiled
shift
}
tmux set-window-option synchronize-panes on
# You can make an alias in your shell as a shortcut to command your servers with ease:
alias cluster_control="tmux new 'exec ./cluster.zsh user@host1 user@host2 user@host3'"
# Inspired by http://perlstalker.vuser.org/blog/2013/09/24/cluster-ssh-with-tmux/
@hukl
Copy link
Author

hukl commented Dec 11, 2013

Of course this can be easily adopted to other shells

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment