Everyone and his dog has their multihost ssh so why not me?

I call this sshtomany:

#!/bin/bash

cmd="$*"
cmd="${cmd/#* . /}"
[ "$cmd" = "$*" ] && echo "Usage: $0 [HOSTS] . [COMMAND]" && exit 127

while [ "$1" != . ] && ssh $1 -vt $cmd ; do
  echo Success at "$1"
  shift
done

clusterssh and its emacs equivalent are quite handy if you want to execute commands simultaneously and fairly graphically.

The various versions of dsh and dssh are flexible command-line tools.

But sshtomany will do 90% of simple jobs by running the same ssh command on a list of hosts, one after another.

This entry was posted in GNU/Linux and tagged , , , , . Bookmark the permalink.

4 Responses to Everyone and his dog has their multihost ssh so why not me?

Leave a Reply

Your email address will not be published.