Wednesday, February 24, 2010

Shell script to execute command on the list of computers

The list of computers is given as a text list of IP adresses named "all.list". Each IP in saparate line

To execute commands on each computer create file all.sh with following text
for i in `cat all.list | awk '{ print $i}'` ; do echo $i; ssh $i $1 ; done

Execute commands by
> source ./all.sh "ls -la"

No comments:

Post a Comment

Followers

About Me