Rsync to backup directory

Posted on 2005-02-28
Medium Priority
Last Modified: 2013-11-22
Hey Experts,

I have a development directory on my FreeBSD box. I use Samba to connect to this tree with my Windows XP Pro PC. I would like to setup and cron job rsync to backup any changed files on the Unix development directory to my Windows XP PC nightly. Is there a way I could have it increment changed files?

For example, if header.png was changed, backup the old header.png on my Windows XP box to "(date)_header.png" or something to tell it apart?

I will extend this into two 500 point questions if needed (one for Rsync and one for the increment naming).

Question by:drakkarnoir
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
  • 2

Accepted Solution

it_alchemist earned 1800 total points
ID: 13425433
I'd recommend following this tutorial: http://www.gaztronics.net/rsync.php

which covers good ground and should help you get setup on your windows machine.  In terms of incrementing, again I'll refer you to a thorough tutorial instead of repeating the same info here. I found the information on this site to be very helpful as it explains in detail why things work and includes a very useful script which will work fine with BSD as well.


If you have any problems, please post here and we can help you debug.


Author Comment

ID: 13426837
Ok I installed rsync like that guide said on my Windows machine, but I can't find a port for it in FreeBSD?

Author Comment

ID: 13426855
Found it under net, continuing...
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 13426920
Ok so I got rsync setup on both boxes, and then this on my Windows box:

C:\Documents and Settings\Admin>c:\Cygwin\bin\rsync -vrtz --password-file=c:\cygwin\secret --delete /cygdrive/D/Data Me:
rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at /home/lapo/packaging/tmp/rsync-2.6.3/pipe.c(83)
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packaging/tmp/rsync-2.6.3/io.c(359)

D:/Data exists

Assisted Solution

by:David Piniella
David Piniella earned 200 total points
ID: 13430746
is ssh installed in your windows/cygwin machine?

Author Comment

ID: 13431557
No, how do I install it?

Author Comment

ID: 13432003
Ok got ssh installed and running, now it says:

ssh: User: no address associated with name
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packaging/tmp/rsync-2.6.3/io.c(515)

With the same command as above.

Expert Comment

by:David Piniella
ID: 13432125
make sure you're using the same username on both systems

Author Comment

ID: 13434009
Yeah, User is my Windows username and I have a user called User on my bsd box too...

Author Comment

ID: 13442591
Ok, this is where it stands now, and I am stuck:

I am able to do -

C:\Documents and Settings\Admin>c:\Cygwin\bin\rsync -vrtz --password-file=c:\cygw
in\secret --delete /cygdrive/D/Data
building file list ... done

sent 64 bytes  received 20 bytes  33.60 bytes/sec
total size is 11  speedup is 0.13

So if I create test.txt, it will be copied over into the directory I specifed for [User] in rsync.conf. Excellent!

Now, I tried a varied command on my *nix box (since my whole goal was to backup the *nix directory into a Windows folder):

rsync -vrtz --password-file=/usr/local/etc/rsyncd.secrets --delete /home/rsync_test/
ssh: connect to host port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(365)

I went into cygwin and did rsync --daemon but stiill got the same error. Any ideas?

Expert Comment

ID: 13445678
You need to configure sshd on your windows box to allow connection from your bsd box. You do this by editing sshd_config in your cygwin environment and making sure that the ListenAddress is set to and that the file locations are set properly.

Here are a few cygwin+openssh tutorials to look at:




Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question