Skip to content

Instantly share code, notes, and snippets.

@ric2b
Last active March 16, 2017 21:22
Show Gist options
  • Save ric2b/85d118115788ffa967316adaaee2e741 to your computer and use it in GitHub Desktop.
Save ric2b/85d118115788ffa967316adaaee2e741 to your computer and use it in GitHub Desktop.
rsync to multiple machines with same account
#!/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