2-way rsync

I’m working on a project where I need copies of files both at my laptop and at my home dir somewhere else.
I’ve setup an rsync script to do 2-way synchronization between my laptop and the home dir like this:

#!/bin/sh

remote="joar@remote.server.address"
rdir="remote_sync_dir/"
ldir="/home/joar/local_syncdir/"

rsync -e ssh -vaurP $ldir $remote:$rdir
rsync -e ssh -vaurP $remote:$rdir $ldir

Note: to avoid having to type your password for each sync one should setup ssh-keys.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.