Created
December 29, 2011 18:21
-
-
Save kkismd/1535415 to your computer and use it in GitHub Desktop.
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/bash | |
function cmd() { | |
target=$1; shift | |
pane=$1; shift | |
tmux send-keys -t:$target.$pane "$*" C-m | |
} | |
function window() { | |
tmux new-window -a -n "$1" | |
} | |
function cube() { | |
for i in {1..8} | |
do | |
tmux split \; select-layout tiled | |
done | |
} | |
function usage() { | |
echo Usage: $0 \'command --options arg1 arg2 ...\' host1 [host2 host3...host9] | |
} | |
if [ $# -lt 2 -o $# -gt 10 ]; then | |
usage | |
exit 1 | |
fi | |
remote_command=$1; shift | |
window_name=`echo $remote_command | sed 's/ .*//'` | |
window $window_name | |
cube | |
i=0 | |
for host in $* | |
do | |
cmd $window_name $i ssh $host | |
cmd $window_name $i $remote_command | |
i=`expr $i + 1` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment