How to rsync two folder over network(ssh) in mac laptops?

I have two mac laptop and both has rsync installed. I would like to rsync a Folder from Mac A to Mac B. and run it via crontab every hour, so that all the differential would be keep syncing every hour. I would like to understand how to do it. any help on command would be very much appreciated. Thanks!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rsync is a unix/linux command and you can look up the man (manual) page with the following command:

man rsync

The basic command is:
rsync -a source destination

You can use remote system names, if you have a working DNS, or IP addresses.

To copy a remote folder on a system at IP address to a local folder:
rsync -a remote_user@  /Users/Admin

To copy a local folder to the remote folder on a system with IP address
rsync -a   /Users/Admin  remote_user@
man cron
man crontab

If you want to put that in a crontab, you can use sudo crontab -e, if you know vi or emacs.  It's set by the EDITOR environment variable.  Beginners can try pico or nano editors.  You can also use any text editor to edit the file directly, but sudo crontab -e will do error checking and not let you save it with broken syntax.

To change the default editor for crontab or visudo or other unix commands to nano:
export EDITOR=nano

Standard cron entries are placed in /var/spool/cron in linux/unix, but Apple has moved it to /usr/lib/cron/tabs/.  You can use any editor, such as Text to edit it, but it's best to use crontab -e if you're a beginner on the syntax.

There are 6 fields in normal user cron that are separated by spaces.
Day of the month
Day of the week
Command to run

You can have multiple entries in each field by separating them with a command and no spaces in between.  The 6th field can contain spaces between the command and arguments.  The first 5 spaces separate the 6 fields.

Here's what you put in cron to schedule the rsync at every 15 minutes and 45 minutes after the hour:
15,45 * * * * rsync -a   /Users/Admin  remote_user@

Here's one that occurs at 1:05 am every night.
5 1 * * * rsync -a   /Users/Admin  remote_user@

Here's one that occurs at 1:05 am , on the 5th, 15th and 25, of the month.
5 1 5,15,25 * * rsync -a   /Users/Admin  remote_user@

Here's one that occurs at 1:05 am , every Sunday and Wednesday.
5 1 * * 0,3 rsync -a   /Users/Admin  remote_user@

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Mac OS X

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.