Copy A File To Multiple Machines At Once

This is a script I made up to help send files to multiple machines at once. Only one hickup that may occur...you have to have the same logon username and password on all machines....which in a business enviroment with a ldap backend this is fairly easy.



Once you have the file saved, make it executable either using graphical tools or from a console
chmod +x filename.sh the .sh extension tells the graphical enviroment that its a shell script


Run the script from a terminal multicopy.sh USERNAME FILETOTRANSFER PATHONREMOTESERVERS HOSTFILE where USERNAME is the username to use on all servers, FILETOTRANSFER is the file on the local machine that you want on the remote hosts, PATHONREMOTESERVERS is the path on the remote servers you want to put the file to, and HOSTFILE is a file containing all the hostnames or ip address of all the hosts you wish to transfer your file to.


For example: multicopy.sh bob wallpaper.jpg /tmp/ myhosts.txt and myhosts.txt could look like


192.168.1.100
192.168.1.101
192.168.1.102
192.168.1.103
192.168.1.104