Skip to content

Instantly share code, notes, and snippets.

@asimjalis
Last active August 29, 2015 14:00
Show Gist options
  • Save asimjalis/11011349 to your computer and use it in GitHub Desktop.
Save asimjalis/11011349 to your computer and use it in GitHub Desktop.
# To run a command on all 4 hosts type: ethm COMMAND
# For example: ethm hostname
# You can also type:
#
# eth COMMAND # Run COMMAND on elephant, tiger, horse
# thm COMMAND # Run COMMAND on tiger, horse, monkey
# h COMMAND # Run COMMAND on horse
# m COMMAND # Run COMMAND on monkey
#
# And so on.
function push_useful() {
scp useful.sh elephant:.
scp useful.sh tiger:.
scp useful.sh horse:.
scp useful.sh monkey:.
}
function kv() {
for kv1 in $*; do
set -- `echo $kv1 | tr '=' ' '`
echo " <property>"
echo " <name>$1</name>"
echo " <value>$2</value>"
echo " </property>"
done
}
function xx() {
HOSTS=$1
shift
for i in $HOSTS ; do
echo ==$i==
ssh $i $*
done
}
alias ethm='xx "elephant tiger horse monkey" '
alias eth='xx "elephant tiger horse" '
alias et='xx "elephant tiger" '
alias thm='xx "tiger horse monkey" '
alias e='xx "elephant" '
alias t='xx "tiger" '
alias h='xx "horse" '
alias m='xx "monkey" '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment