-
-
Save azhai/7dc7a215c2edb92047e3ded317dec2d3 to your computer and use it in GitHub Desktop.
Copy files between servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
i=0 | |
declare -a args | |
for x in "$@"; do | |
args[$i]=$(readlink -f "$x") | |
i=$(expr $i + 1) | |
done | |
user=ryan | |
#source=10.1.2.3 | |
targets=( | |
10.1.147 | |
10.1.258 | |
10.1.369 | |
) | |
for ip in ${targets[*]}; do | |
echo $ip | |
for f in ${args[*]}; do | |
sudo /usr/bin/rsync -rtopg "$f" "$user"@"$ip":"$f" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment