Yet another small package that I use all the time that not too many folks may know about is mussh (MUlti host SSH wrapper). Read on for a quick overview of this useful script.
mussh is a small shell script that allows you to run a command on a list of hosts, without having the hassle of logging into each host and doing the command. You can run it to connect to each host in turn, or fork off asynchronously and run the command on all the hosts at the same time. mussh will use ssh-agent if it's setup and your keys are loaded, so you will only need to type passwords as much as you would need to normally if you were logging into each host.
I use mussh every day. For example, I have a file that has a list of all my personal machines, one per line like:
Then, I can run mussh like so: “mussh -H .hosts/localhosts -c 'yum check-update' ” for example to run a 'yum check-update' on each of the hosts in turn to see what updates are pending. I can then run the same command with 'yum -y update' in order to apply the updates.
Another example would be when a new version of the smolt utility is released, and you want to update all your hosts entries. You can simply do a “mussh -H hostlist -c 'smoltSendProfile -a'” to update all your hosts in hostlist in one command.
In addition to giving mussh a command on the command line you can tell it to read from a file a list of commands. If you want to do more complicated commands on each host this is the way to go.
You can also specify hosts on the mussh command line with a set of '-h user@hostname' type arguments. This is useful if you have a list of hosts you don't expect to re-use again. There are a number of arguments, check the mussh man page for more information on them.
mussh is of course available for Fedora users. Simply 'yum install mussh' to install the package. I find it to be a very handy tool for day to day sysadmin duties.comments powered by Disqus