Created
May 24, 2011 09:01
-
-
Save dln/988381 to your computer and use it in GitHub Desktop.
Create aliases for working with remote clusters.
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
# | |
# Dependencies (Debian): pssh, pdsh, cssh | |
# | |
# Under ~/.pssh/ I keep lists of hosts, one cluster per file, one hostname per line. | |
# | |
alias mssh='f() { hosts=$1; shift; for h in $(cat ~/.pssh/$hosts); do ssh $h $@ ; done }; f' | |
# auto-generate aliases for common host groups | |
for hostlist in $(ls ~/.pssh/); do | |
for cmd in ssh scp rsync slurp nuke; do | |
alias p$cmd-$hostlist="parallel-$cmd -h ~/.pssh/$hostlist" | |
done | |
alias pdsh-$hostlist="pdsh -w \$(tr \\\\n , < ~/.pssh/$hostlist)" | |
alias cssh-$hostlist="cssh \$(tr \\\\n ' ' < ~/.pssh/$hostlist)" | |
alias mssh-$hostlist="mssh $hostlist" | |
done | |
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 | |
hostsfile=$(ls ~/.pssh/ | dmenu -fn 10x20) | |
[ -n "$hostsfile" ] && exec cssh $(cat ~/.pssh/$hostsfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment