Author Topic: Using rsync-to-rsync between two OS/2 systems  (Read 9893 times)

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 395
  • Karma: +5/-0
    • View Profile
Using rsync-to-rsync between two OS/2 systems
« on: January 08, 2014, 03:05:42 am »
I'm trying to mirror a directory between two OS/2 systems using rsync.

I run 'rsync --daemon' on one system and then try to use rsync from the other, using a command for instance like 'rsync -ahnuvzX --progress . rsync://192.168.0.4/kmd'.

However, no matter what options I use, I always get this error:
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]


(I've also tried specifying the remote address as '192.168.0.4::kmd' which makes no difference.)

The rsyncd.log on the side running the daemon shows this:
2014/01/04 15:26:19 [209] rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory (2)
2014/01/04 15:26:19 [209] rsync error: syntax or usage error (code 1) at clientserver.c(957) [Receiver=3.0.9]


The file rsyncd.conf is located in %ETC% (which the daemon requires in order to run without complaint) and I've also put a copy in /etc just in case. So I suspect the configuration file error is spurious. Here's the contents of the file, though:

# Configuration file for rsync daemon
log file = c:/var/log/rsyncd.log

[kmd]
path = w:/kmd


Can anyone help?

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1599
  • Karma: +4/-2
    • View Profile
Re: Using rsync-to-rsync between two OS/2 systems
« Reply #1 on: January 08, 2014, 04:15:37 am »
This will be a brief starter course.   :)

It seems that you did not make a rsyncd.conf file, which is necessary.

First of all, I try to avoid putting rsyncd.conf in %etc%. There are already too many things in there, so I use the command to point it to the rsyncd.conf file. The command that I use is:
Code: [Select]
W:\utility\rsync\rsync.exe --daemon --config=W:/Utility/rsync/rsyncd.conf --log-file=W:/Utility/rsync/logs/rsyncd.logI actually do that with a program icon, but I am sure you can figure that part out. Note the forward slashes (I am not sure that they are necessary, but this is a Linux program). This is, of course, on the "remote" machine. To be able to do anything with that, you need to make the rsyncd.conf file. A shortened version of that is as follows:
Code: [Select]
#    max connections = 6
#    transfer logging = yes
    read only = false
    timeout=1200

#    lock file = v:/temp/rsyncd.lock
    log file = W:\Utility/rsync/Logs/rsyncd.log
#    pid file = v:/temp/rsyncd.pid
    motd file = W:/Utility/rsync/rsyncd.motd

[adirectory]
    hosts allow = 192.168.0.100/24
    comment = adirectory
    path = U:/adirectory
#    read only = false
#    list = yes
    gid = root
    uid = root

[pictures]
    hosts allow = 192.168.0.100/24
    comment = Pictures
    path = W:/pictures
#    read only = false
#    list = yes
    gid = root
    uid = root
This basically assigns a target for the operation ([adirectory]), with a real location for it (path=U:/adirectory). The # lines are commented out. "gid" = Group ID, and "uid" = user ID (Linux concepts), which seem to allow, or deny, access. The rest should be pretty obvious. You will, of course, need to modify it to match your own systems. I show the second one [pictures] to show that you can have any number of entries (within reason).

Okay start the daemon, which should use that file (which can be modified, without having to restart the daemon).

Next, on the "local" system (the other one), I use a command like:
Code: [Select]
W:\UTILITY\RSYNC\BIN\RSYNC.EXE -aX --progress --delete --log-file=logs/RsyncALL.log --filter=._W:/Utility/rsync/filters.list U:/adirectory/ 192.168.0.116::UDrive/
In this case, I am "smart" copying the contents of (local machine) U:/adirectory to the remote machine U:/adirectory. The trailing slash is not always necessary, but it gives you more control over what happens. The * (all files) is assumed. The "r" (part of "a") recurses through directories.  I use the parameter "a", which basically does everything, except EAs, which the "X" does. Note that the target is "adirectory", which is defined in the remote machine's rsyncd.conf file. That is case sensitive, and must match, exactly. The machine's IP address can be a normal URL, as long as there is a way to convert it to the IP address. I use "--progress" so I don't get bored wondering how much has been done, and "--delete" so that RSync will delete files on the target, that no longer exist on the source (otherwise, it just keeps adding new files). filters.list contains a list of files that I don't want to copy (you need to read the filter instructions), but mine looks like:
Code: [Select]
- $live$
- Cache/*
- Cache.Trash/
- umix.log
- DSS_RMT.PID
- /PROCDUMP/
- /CDTemp/
- Recycled
- /TEMP/
- /SPOOL/
- /SWAPPER/
- rsync*.log

Some experimenting will be required to learn what happens. I would recommend experimenting with a test machine (in VBox perhaps), that you don't mind messing up. If you do the wrong thing, it is possible to start overwriting what is already there, with stuff that you may not want where it goes.
« Last Edit: January 08, 2014, 04:22:03 am by Doug Bissett »

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 395
  • Karma: +5/-0
    • View Profile
Re: Using rsync-to-rsync between two OS/2 systems
« Reply #2 on: January 09, 2014, 06:05:51 am »
It seems that you did not make a rsyncd.conf file, which is necessary.

It seems that you didn't read my post very carefully.

You are correct that it was missing a few desirable parameters. I find it odd that the distribution doesn't include even so much as a sample or skeleton config file, I suspect it would save a number of headaches. But that wasn't my actual problem.

Anyway, with Steven Levine's help I've gotten it working now, by using both the --config and --no-detach options.

Thanks.

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1599
  • Karma: +4/-2
    • View Profile
Re: Using rsync-to-rsync between two OS/2 systems
« Reply #3 on: January 09, 2014, 06:15:31 pm »
Quote
It seems that you didn't read my post very carefully.

Actually, I did. What made me think you did not make a config file was (from the log):

Quote
2014/01/04 15:26:19 [209] rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory (2)

but then I did miss that it was telling RSync to look in the root of the current drive, for the etc directory. That problem is looked after by the KLIBC PathReWriters program, which redirects *nix paths (/etc) to normal OS/2 paths (C:\MPTN\ETC) for you.

I will also suggest that using -z on a local network that runs at 100 Mbs, or faster, probably slows the data transfer, especially if one, or both, of the machines is slow. I find that it takes more time to zip/unzip the data, than to just send it as plain data. -z would be useful, if you are transferring data over a very slow connection.

Quote
I find it odd that the distribution doesn't include even so much as a sample or skeleton config file, I suspect it would save a number of headaches.

I suspect that such a thing would cause more confusion than it would prevent. There are so many useless (in OS/2) options, that would need to be demonstrated, that it would probably become  unusable. I got the http://www.os2notes.com/files/RsyncBackup-006c.zip package, which has some useful samples in it.

This gets even more interesting if you try to use RSync on OS/2 to sync with RSync on Linux. I got it to work, but there are a few anomalies that I never resolved (UTC time vs. local time was the big one).