for loop for scping files to a list of servers
filed in Uncategorized on Dec.04, 2009
This little command line statement will copy a folder of files to the list (space separated) of hosts in your client list.
for i in `cat client_list.txt`;do `scp -r directory root@$i:~/`;done
You also need to load keychain on your desktop and have your ssh key loaded on the server to avoid typing your password for each host.
You can also run a single command on each server like this example using df -h:
for i in `cat client_list.txt`;do echo $i; ssh root@$i ‘df -h’;done
