I have more than 60 ubuntu systems in my network. I want to copy files from one system to other ubuntu systems. All IP addresses are listed in a text file.
So what command can I use to complete the task? Any bash programs?
|
I have more than 60 ubuntu systems in my network. I want to copy files from one system to other ubuntu systems. All IP addresses are listed in a text file. So what command can I use to complete the task? Any bash programs? |
||||
|
|
suppose that you have your IP addresses in a file named ips.txt, each IP in a line. create a file named, for example *scp_all.sh* and copy the following text bellow in it:
then execute it in this way:
this is a really simple script, while it supposes that your username in all computers is root, it doesn't store password and you have to enter it each time, and it doesn't have any exception handler. if you want to change the destination address, change the second $1 in scp command with $2 and use the script in this way:
I've said that you have to enter your password for each computer, but if you have decided to use this script regularly, you can solve this problem by this simple 6-step solution described here. good luck ;-) |
|||||||||||
|
|
Lekensteyn is correct -- you should probably be pulling the files from the server, rather than pushing them to the clients from the server. If you're going to be doing this regularly (especially with a large number of files), I would set up rsync or a version control system such as git, rather than FTP, so that the clients only have to download things that have changed. |
|||
|
(upgrading from earlier comment) You may also want to look into a configuration management system such as Puppet, bcfg2, or Chef to manage distributing files across a network. |
|||
|
|