Skip to Content

dsh: dancer's shell gives you power over multiple Macs

This month's MacTech magazine offers a feature article by Edward Marczak on using dsh, the "dancer's shell" or distributed shell utility, to batch-administer machines in a single blast without having to hit each one, or use a pricey management tool such as ARD or LANrev. Although dsh isn't included with Mac OS X or available as a binary or port build, it does compile cleanly on the Mac and should work well out of the box.

The idea behind dsh is to take a list of targets (machines you can reach via SSH), and run a command or extended script on all of them at once. This is functionality that's wrapped up in a nice GUI in Apple Remote Desktop; it's deeply powerful and very handy. Supposing you wanted to check the uptime for a bunch of your lab boxes -- manually, you'd have to run around, or SSH to each one and run the 'uptime' command. With dsh, you make your machine list (optionally, loading your SSH public key on the machines ahead of time to avoid password prompts) and run one command:

dsh -Ma uptime

Very handy. The full article isn't online yet, but it's worth seeking out a copy of the magazine if you're interested in automation of enterprise Mac admin tasks.

Categories

Cool tools Open Source

This month's MacTech magazine offers a feature article by Edward Marczak on using dsh, the "dancer's shell" or distributed shell utility,...
 

Add a Comment

*0 / 3000 Character Maximum

12 Comments

Filter by:
mzsanford

There is a feature in iTerm that lets you send commands to multiple windows. I like it because I can chain a tail -f of the log after the command and check each host to make sure nothing went wonkey.

January 14 2008 at 11:54 AM Report abuse rate up rate down Reply
artifex

I was going to suggest looking to see if fink has a package, but oops, looks like Godaddy's parked the domain name now. sad :(

January 12 2008 at 3:27 AM Report abuse rate up rate down Reply
1 reply to artifex's comment
artifex

oh, hah: "Fink Is Not Kaput ;)"
http://www.racoonfink.com/archives/000752.html

January 12 2008 at 3:28 AM Report abuse rate up rate down Reply
James

There is also pdsh, for running it in parallel

January 12 2008 at 12:45 AM Report abuse rate up rate down Reply
Josh

yeah I built a very robust perl script that does this with many very nice options about 2.5 years ago. I update it and add features frequently so it's become quite a nice tool.

This is a definite need for many admins tho so kudos!

January 11 2008 at 9:37 PM Report abuse rate up rate down Reply
Michel

I made a kind of similar tool at my work on my mac (and linux of course)

it uses texts lists but also LDAP to get list of computers to ssh-execute the command.

for example, I can ask "all machines in the room 305" and it uses ldap to know what are the ip of the computer in the 305 room.

I made also little scripts and a website (for admins colleagues) to manage my custom directory of computers.

January 11 2008 at 6:19 PM Report abuse rate up rate down Reply
SireB

What is the port name? 'sudo install port dsh' doesn't seem to work

January 11 2008 at 4:14 PM Report abuse rate up rate down Reply
1 reply to SireB's comment
Michael Rose

Sire, I said it's NOT in Macports. Sorry, you'll need to compile from source... :-)

January 11 2008 at 4:32 PM Report abuse rate up rate down Reply
Fabio

Well, cool idea. "But" we've been doing that already for some time thanks to the Ruby on Rails deployment tool "Capistrano". One of its feature is exactly a command line "cap shell" that allows us to run shell commands in multiple machines (and check its output). It also uses ssh, by the way.

January 11 2008 at 3:55 PM Report abuse rate up rate down Reply
jadam

I used dsh a lot when I was administering a beowulf cluster. Glad to hear that it's working on the Mac. Here's a quick tip: set up a public/private keypair within ssh for the user you're planning to use, and make sure you can ssh over with no password prompt before trying to use dsh. Typing the password over and over again is no fun.

January 11 2008 at 3:22 PM Report abuse rate up rate down Reply
Aaron Davies

Interesting. I have a primitive version myself, basically just a wrapper on "for host in ...; do ssh $host $*; done". I called it "blast". I'll have to give this a try.

January 11 2008 at 2:32 PM Report abuse rate up rate down Reply
1 reply to Aaron Davies's comment
Michael Rose

Let us know how it goes. Interesting challenge is doing tasks that require admin access on the remote host, as it's hard to pass a sudo password through (at least it was for me).

January 11 2008 at 2:39 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.