[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

For loop

Posted on 2011-10-07
3
Medium Priority
?
308 Views
Last Modified: 2013-11-17
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).
0
Comment
Question by:AIX25
3 Comments
 
LVL 9

Accepted Solution

by:
jeremycrussell earned 1600 total points
ID: 36933917
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
 

Author Comment

by:AIX25
ID: 36934040
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
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 400 total points
ID: 36934077
Why a "for" loop, (and why "cat")?

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

wmp
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question