Labels

hpunix (63) marathi kavita (52) linux (21) solaris11 (10) AWS (5) numerology (5)

Wednesday, September 7, 2016

Small script to move files to & from multiple servers - Linux

Small script to move files to & from multiple servers:

1. Lets take a scenario in which we want to move files from one source server to multiple servers.

Here, we are taking example that the admin wants to move nmon log files to multiple servers.

nmon_servers = file where multiple servers name mentioned
source path : /usr/local/nmon_monthly
destination path : /usr/local/

for i in `cat /home/kiran/nmon_servers`
do
scp -rp /usr/local/nmon_monthly $i:/usr/local/
done

2. Second scenario is that we want to move files from multiple servers to one server:
nmon_servers = file where multiple servers name mentioned

for i in `cat /home/kiran/nmon_servers`
do
scp -rp $i:/var/log/nmon/* /var/log/nmon/
done

Thanks & Regards,

Kiran Jadhav 

No comments:

Post a Comment