For loop

I have one server (master server) that has ssh keys to all the rest of the servers in the environment. I need help to write a for loop to scp software, script, and etc from my master server to the rest of the servers using a server list I have compiled (all.servers file).
AIX25Asked:
Who is Participating?
 
jeremycrussellCommented:
You looking for something like...

user=someuser
for host in `cat all.servers`
 do
   scp file $user@$host:/someplace/
done

Open in new window


?
0
 
AIX25Author Commented:
I just saw your reply. I'm done here and will be back on Monday to test it out and see if i have any problems! Thanks for you quick response.
0
 
woolmilkporcCommented:
Why a "for" loop, (and why "cat")?

xargs -I{} scp source_spec user@{}:target_spec/ < all.servers

wmp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.