LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is it possible to copy one file to multiple computers (https://www.linuxquestions.org/questions/linux-newbie-8/is-it-possible-to-copy-one-file-to-multiple-computers-4175544902/)

skarthickbabu 06-09-2015 08:54 AM

Is it possible to copy one file to multiple computers
 
Dear All,

Is it possible to copy one file to multiple computers with single line command ?

I generally use rcp command to copy from one computer to another computer.

example:

rcp localfile host1:/home/kb/

now i would ilke to copy the local file to different host's.

so i tried in the following way, but this doesnt work
rcp localfile host1:/home/kb/ host2:/home/kb

any suggestions would beuseful to me
please help me.

regards
Karthick

veerain 06-09-2015 09:07 AM

You can use a shell script loop to do copy in serial or parallel.

skarthickbabu 06-09-2015 09:33 AM

how can i loop them
 
but how can i loop them, do u have any examples?

schneidz 06-09-2015 09:37 AM

normally my response would be show your work and we will help with corrections but this is simple enough it doesnt warrant the effort of my usual lecture (... too late):
Code:

scp test.lq user1@ip1:/whatever/floats/your/boat &
scp test.lq user2@ip2:/whatever/grinds/your/gears &


skarthickbabu 06-09-2015 09:43 AM

Since the folders i copy are on the range of 1-2 GB data, so it takes time for the first one to finish and execute the second time.
I wanted to try opening two terminal and execute at the same time, i have not tried this option because i am not sure how does the data gets distributed in copying at two different locations.
if opening in two terminal works, i am also happy as long as i don't loose the data.

schneidz 06-09-2015 09:47 AM

the ampersand (&) makes it a background process so they both fly at the same time.

skarthickbabu 06-09-2015 09:50 AM

good to know, thank you so much. Now it sounds really silly.
Thanks for all to realize this.


All times are GMT -5. The time now is 01:26 PM.