How to Setup Auto Backup on Mac using RSYNC

Update your Rsync on mac:
First install Homebrew on your mac,

then
brew tap homebrew/dupes
brew install rsync

edit /private/etc/paths
and put /usr/local/bin ahead of /usr/bin and then restart Terminal 🙂

rsync -va –delete ~/Folder1/ ~/Folder2/

#!/bin/sh
echo BEGIN `date` >> /var/log/backup.log
/usr/bin/caffeinate -s /usr/bin/rsync -aH /Users [email protected]: >> /var/log/backup.log
echo END `date` >> /var/log/backup.log

http://www.bananica.com/Geek-Stuff/Synchronize-two-folders-on-a-Mac-with-Rsync/
http://www.practicallyefficient.com/2011/03/18/rsync-automator.html

Best Script

Rsync backup Synology to Raspberry Pi

 

The options I use:

OPTIONS=”-av –no-p –no-g –chmod=ugo=rwX –delete –force”

I have to use –no-p and –no-g, so the folder permissions will be ignored.   and –chmod=ugo=rwX will ensure that all non-masked bits get enabled.

 

SSH to a specific port:

ssh -p 22 [email protected]

SSH in debug mode:

ssh -v [email protected]

Rsync with non-standard SSH Port

rsync -arvz -e ‘ssh -p <port-number>' –progress –delete user@remote-server:/path/to/remote/folder /path/to/local/folder

How to remove folders with a certain name

find . -name folder_name -exec rm -rf {} \;

Leave a Comment