Using RSYNC to transfer files from a Mac to a Winbox

Discussion in 'macOS' started by rhett7660, May 29, 2009.

  1. rhett7660 macrumors G4

    rhett7660

    Joined:
    Jan 9, 2008
    Location:
    Sunny, Southern California
    #1
    Hello..


    If I want to setup up something that would backup information from my Mac to a specific folder on my windows box how would I go about setting this up.

    What I am trying to do is copy a folder that has files xyz. I would like this job to fire off every 3 hours or so looking for changes. I would like those files to be sent to a windows xp box to a specific folder.

    I have been reading on this but I am still pretty new to linux and the such and I have a feeling I am over my head.

    What I have found deals with backing up from a windows ---> say a NAS box. But not from a Mac-->Windows box. If it is easier from a Mac Mini --> to another Mac Mini.. I just need to be able to move files that have changed say every three hours. Hope this makes sense.

    Creating a cronjob or something along those lines?
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    This is the rsync command I use on my Mac Mini to do backups of a drive on my Windows machine,
    Code:
    sudo rsync -avx --progress /Volumes/Archive/ /Volumes/Archive_bkup
    You could then setup a cron job to run every 3 hours.
    Code:
    export EDITOR=pico
    crontab -e
    * */3 * * * sudo rsync -avx --progress /Volumes/Archive/ /Volumes/Archive_bkup >/dev/null 2>&1
    This will setup the editor for the cronjob to be the pico editor, which is a little easier to use than the vi editor. The 2nd line lets you edit the cronjob. The third sets the command to run every 3 hours. The end of that command has a piece to make sure it doesn't email you after running the command.
     
  3. rhett7660 thread starter macrumors G4

    rhett7660

    Joined:
    Jan 9, 2008
    Location:
    Sunny, Southern California
    #3
    Thank you for taking the time to respond..

    Just to clarify.. is your windows box on a network? Or do you have a shared folder on your Mac?

    Thanks
     
  4. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    The Windows machine is on my network. I do have to make sure the windows drive is mounted for the Mac to see though, which is just a manner of finding it through Finder. The drive I back up on Windows is set as Shared. The alternative would be to setup SSH on the Windows machine and connect to it using the IP address with the rsync command. That has a different format for the command. It would look more like,
    Code:
    rsync -avz -e "ssh -i rsync-key" username@192.168.1.25:folder ./local/destination/folder
    The rsync-key part is so I can connect without a password. It takes a little setting up to do that. I recommend following a tutorial such as this one if you go down that road.
     
  5. rhett7660 thread starter macrumors G4

    rhett7660

    Joined:
    Jan 9, 2008
    Location:
    Sunny, Southern California
    #5
    ^^ Ahh.. Thank you. That is what I was looking for.

    Thanks again.... I am sure I will have more questions as I am moving along.
     

Share This Page