Last active
March 16, 2017 21:22
-
-
Save ric2b/85d118115788ffa967316adaaee2e741 to your computer and use it in GitHub Desktop.
rsync to multiple machines with same account
This file contains 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 | |
user=myuser | |
# use ssh keys for simple login | |
machines=(ip1 ip2) | |
for machine in $(machines[*]) | |
do | |
echo "sending $1 to $user@$machine:$2" | |
echo "$machine: $(rsync -avP $1 $user@$machine:$2)" & | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment