dsh "uname -a"I'm going to give a short tutorial on how to set this up on the Mac for a group of machines with ssh available. First of all, I'm using MacPorts, so you'll need to have that installed before proceeding. With MacPorts installed, you can run the following command:
sudo port install dshAfter ports has done it's thing, you will need to create the proper directories:
mkdir -p ~/.dsh/groupThe '-p' tells mkdir to create both .dsh and group directories. Neither of these directories existed for me. Now we need to create a 'group' file with the names of the machines we want to access:
vim ~/.dsh/group/testMachinesAdd machine names to the file with one machine per line. For example:
plutoYou can create as many files in the ~/.dsh/group directory with this format. We will use these files to organize what machines we're sending commands to.
mars
saturn
earth
Now we need to create a config file:
vim ~/.dsh/dsh.confwith the following contents:
verbose=0
remoteshell=ssh
waitshell=1 # whether to wait for execution
# 1 = run commands serially
# 0 = run commands in parallel
remoteshellopt=-lmmasters # mmasters is the login id for the machines
verbose=0
showmachinenames=1
The last thing we need to do is set up passwordless ssh for all the machines in our group file. Once that's done, we can start using dsh. Go ahead and give it a test drive:
dsh -g testMachines 'uname -a'The -g argument tells dsh which group file we want to use.
No comments:
Post a Comment