I would like to copy Elka's home directory (/home/eros/
) from the laptop (asteroid) to the server (jupiter)
and back from jupiter to asteroid as well as from/to jupiter to/from PC machine (darkstar).
So the problem is to sync bidirectionally /home/eros/
on three machines.
On darkstar I run the following script (and similar one on asteroid):
#!/bin/bash # http://wiki.archlinux.org/index.php/Full_System_Backup_with_rsync # SOURCEDIR=/home/eros/ DESTDIR=root@jupiter:/public/DELL/backup/rootfs/home/eros INCLUDED=' --include="/.emacs-local/" --include="/.ssh/" --include="/.emacs" --include="/.bash_profile" --include="/.bashrc" ' EXCLUDED=' --exclude="/.*"' rsync -av -e ssh $INCLUDED $EXCLUDED ${SOURCEDIR} ${DESTDIR} # the other way round now # Cf. http://faculty.wiu.edu/CB-Dilger/s07/rsync-howto.shtml # Extra slash appended to ${DESTDIR}/ is of uttermost importance! rsync -av -e ssh $INCLUDED $EXCLUDED ${DESTDIR}/ ${SOURCEDIR}
Adding an exclude switch, --exclude="/.*"
excludes all top-level hidden files/directories. Those
few which should not be excluded are specified with series of --include
switches.
Order is important---first --include
switches then --exclude
switches.