11 comment

  1. If you want to fully parallelize the script you can wrap the ssh command in parentheses in order to execute in a subshell, I believe. That way the script doesn’t wait for the program to finish. I use this to dynamically test all the workstations in my lab (~150) to see which ones are up and running, so I can generate a machine list for a distributed MPICH program.

  2. Very nice script. I use(d?) to manually write a “for” loop every time I need to run the same command on multiple hosts.
    I’ve just modified your sample script, declaring another variable (COMMAND=$@) to use instead of “w”, so I can run
    ./dsh cat /etc/hosts to get the content of all servers’ /etc/hosts in my mailbox.

  3. i tested this script found not working when one of host is down ssh command does not proceed to next host

    please help


  4. Hi, the script is really help ful!! Thanks for this. I want to add one small things for the administrators / developers who want to execute a command only on the remote machine via ssh + shell script e.g ssh test@ ‘service httpd status’ ….if some one want to change the single quoted parameter…he has to defined that much variable and called each variable one by one as per his desire to form expected command…check this code

    for I in $INPUT
    echo -e "----------------------------------------------n";
    for ip1 in $I2
    for ip2 in $I3
    ssh root@ $I $ip1 $ip2
    echo -e "----------------------------------------------n";
  5. Nice article. Interesting subject.

    Just wanted to tip about fabric. Great tool for deployment / Installation / admin python scripts

    Have a question? Post it on our forum!