News for hackers. Stuff that matters.
Re:Cluster SSH (OSX) by JonnieCache on Friday April 01, 2011 @02:43PM (#2397464)
This is surely the most elaborate excuse ever for not writing those maintenance scripts?
Re:Cluster SSH (OSX) by VMG on Friday April 01, 2011 @06:27PM (#2398367)
Could be worthwhile seeing when something goes wrong on one machine. It would be great to bundle all terminals that look the same though
Re:Cluster SSH (OSX) by ceejayoz on Friday April 01, 2011 @04:09PM (#2397804)
It's great for those little tweaks like adding a symbolic link.
Re:Cluster SSH (OSX) by ilikepi on Friday April 01, 2011 @04:32PM (#2397910)
meh...

    for h in host1 host2 host3; do \
        echo -e "\n$h\n===========\n"; \
        ssh $h 'ln -s /some/path /path/to/link && ls -l /path/to/link'; \
    done
edit: woops, left out a couple semicolons...
Re:Cluster SSH (OSX) by geocar on Friday April 01, 2011 @05:11PM (#2398094)
> edit: woops

Exactly.

One-offs are easy to test interactively with cssh, and despite what anyone thinks, there are always one-offs in the real world.

Re:Cluster SSH (OSX) by ilikepi on Friday April 01, 2011 @05:23PM (#2398139)
True. Usually when creating a shell loop like this, I prepend 'echo' in front of 'ssh...' as a dry run first. I also wouldn't actually use something like this for commands that are destructive in nature. Usually it's for things like running informational commands ('rpm -q', 'uptime', etc). Of course anything can become destructive if you fat-finger it hard enough.

In short, use automation with care.

Re:Cluster SSH (OSX) by fragsworth on Friday April 01, 2011 @05:12PM (#2398103)
FUCKING SERIOUSLY?!

Thank you for this comment, I never knew you could pass commands to ssh.

Re:Cluster SSH (OSX) by z2amiller on Friday April 01, 2011 @06:08PM (#2398291)
Now combine that with dsh (http://www.netfort.gr.jp/~dancer/software/dsh.html.en) and authorized_keys, you can _really_ get in trouble. dsh is similar to this Cluster SSH, but is appropriate for use in scripts, cron jobs, etc.

Example:

dsh -Mg all-machines -F 20 'do something'

-M: Prepend any line of output with the machine that emitted it

-g: runs the group all-machines (just a text file in etc/dsh/group)

-F 20: forks at most 20 copies of ssh in the background so you don't overload the server you're running this from

Re:Cluster SSH (OSX) by joh6nn on Friday April 01, 2011 @05:46PM (#2398228)
i suggest perusing the ssh man, then, as it seems likely that it has other capabilities you don't know about.
Re:Cluster SSH (OSX) by rbranson on Friday April 01, 2011 @09:57PM (#2398870)
Like how SSH agent forwarding can allow you to hop from box to box with the SSH keys loaded onto your local machine's SSH agent? Found that one a few months ago, made me reflect on what I've been doing in life the past 10 years not thoroughly reading UNIX man pages.
Re:Cluster SSH (OSX) by erikig on Friday April 01, 2011 @11:50PM (#2399072)
Thanks for this one. You just added a few days to my life and helped push out the onset of carpal tunnel/arthritis. ~ http://www.unixwiz.net/techtips/ssh-agent-forwarding.html
Re:Cluster SSH (OSX) by jberryman on Friday April 01, 2011 @11:27PM (#2399031)
ssh is magic. checkout -X for X11 forwarding to run remote GUI apps, and -R which lets you set up a reverse SSH tunnel when you need to connect to a machine behind a firewall.
Re:Cluster SSH (OSX) by Raphael_Amiard on Saturday April 02, 2011 @05:29AM (#2399578)
such a polite version of RTFM, i love you
Re:Cluster SSH (OSX) by taylorbuley on Friday April 01, 2011 @05:49PM (#2398233)
Based on a similar reaction a few months ago, this will definitely change the way you go about system work.
Re:Cluster SSH (OSX) by veritgo on Saturday April 02, 2011 @04:04AM (#2399506)
You probably already know this, but if you have a significant number of hosts:

    for i in `seq 1 30`; do \
        echo -e "\nhost$i\n===========\n"; \
        ssh host$i 'ln -s /some/path /path/to/link && ls -l /path/to/link'; \
    done
Also, if you just start typing

  for i in `seq 1 30`
  do
     commands
     more commands
  done
On the command line itself, you don't need to worry about semicolons. Bash will take care of it.
Re:Cluster SSH (OSX) by ilikepi on Saturday April 02, 2011 @10:11PM (#2401552)
Ah, I was not aware of seq; good one. :)

Good point about not needing semicolons for multiple-line stuff (assuming the EOL's are not escaped, as you have it in your example). I blame the PHP I spent all week immersed in...bleh.

Re:Cluster SSH (OSX) by jseban on Saturday April 02, 2011 @01:04PM (#2400344)

    for i in {1..30}; do...