View Single Post
  #1   (View Single Post)  
Old 20th January 2009
bigb89 bigb89 is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 69
Default Running a command with input from a file.

Hi guys,

Here's what I'm trying to do:

I have a backup server in my network that has passwordless ssh connection to all the servers in the network. I have a script called "load_checker.sh" that I wanna use to monitor the load on all the servers. Now, I wanna copy load_checker.sh to all of the servers in the network.

I have a list of all of the servers in the network, so to make my job easier, it would be alot faster if I could just run the following command from the backup server:

scp load_checker.sh user@$serverlist:/some/directory/load_checker.sh

The variable $serverlist will be all of the servers that are listed in the serverlist file. That way, load_checker.sh will be sent to every server that's listed on the file. The serverlist file will have each server separated by a line, example:

server1
server2
server3
.....

So as you guys may have noticed, I know the concept what needs to be done, but I just don't know what I have to do.

Conclusion: What would be the best way to scp load_checker.sh to all of the servers that are listed in the serverlist file?

Kind regards,
--Bigb89
Reply With Quote