LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rsync problem: command not found (https://www.linuxquestions.org/questions/linux-software-2/rsync-problem-command-not-found-658831/)

j_70 07-28-2008 01:49 PM

Rsync problem: command not found
 
I am trying to run a simple rsync job on RHES4 but keep getting a command not found error. The job is this:

rsync -r <my user>@<my server>:/home/myuser/ /batch/

This is the error message:

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


I have tried feeding it the rsync path with --rsync-path=/usr/bin/rsync but still not luck. Ideas?

trickykid 07-28-2008 02:13 PM

How about just placing the full path to the executable:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

And you might want to put /usr/bin in your users path, this is a common place for most executables you'll end up running anyways. I find it strange it's not already in your path, unless you don't have rsync installed. ;)

AlucardZero 07-28-2008 02:17 PM

that looks like rsync is not installed on the remote server. is it?

trickykid 07-28-2008 02:27 PM

Quote:

Originally Posted by AlucardZero (Post 3228978)
that looks like rsync is not installed on the remote server. is it?

To my knowledge rsync doesn't need to be on the remote machine since by default it will use the ssh protocol.

j_70 07-28-2008 02:33 PM

I tried this but I get the same error:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


Rsync is on my server:
which rsync
/usr/bin/rsync


It is not on the remote server, but as trickykid stated, my understanding was that it did not need to be.

trickykid 07-28-2008 02:37 PM

Quote:

Originally Posted by j_70 (Post 3228993)
I tried this but I get the same error:

/usr/bin/rsync -r <my user>@<my server>:/home/myuser/ /batch/

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(359)


Rsync is on my server:
which rsync
/usr/bin/rsync


It is not on the remote server, but as trickykid stated, my understanding was that it did not need to be.

Maybe it's trying to use rsync on the remote server as well. Try adding a -e ssh in the command like this:

/usr/bin/rsync -r -e ssh <my user>@<my server>:/home/myuser/ /batch/

j_70 07-28-2008 02:41 PM

Hmmm. Same error. Maybe it does need to be installed on the remote server?

trickykid 07-28-2008 02:54 PM

Quote:

Originally Posted by j_70 (Post 3229003)
Hmmm. Same error. Maybe it does need to be installed on the remote server?

Hmm.. I just tested without and got the same error. I'm guessing rsync is needed on remote destination machine in order to carry out the copy. I could have sworn in the past or previous versions it wasn't necessary, but then again, I always have rsync installed on all Linux machines I administer. ;)

j_70 07-28-2008 02:58 PM

Seems to be. This is going to Windowz over SSH so I was hoping that I could just use rsync to copy only new files over. Does SCP have an rsync-like option to only copy new files?

trickykid 07-28-2008 03:01 PM

Wait, you're trying to go from Linux to Windows? SCP does not to my knowledge have rsync type capabilities and will overwrite existing files, etc.

j_70 07-28-2008 03:13 PM

Yes (unfortunately) Linux -> Windoze. I read some information on the Samba / rsync list that this was possible, if ssh was set up. Apparently not, however. Maybe rdiff will work.

trickykid 07-28-2008 04:00 PM

Quote:

Originally Posted by j_70 (Post 3229029)
Yes (unfortunately) Linux -> Windoze. I read some information on the Samba / rsync list that this was possible, if ssh was set up. Apparently not, however. Maybe rdiff will work.

The only time I've seen rsync work with Windows and or going to Windows is when I had sshd running in a cygwin instance. There might be a Windows SSH daemon but I've never dealt with it directly.

chrism01 07-28-2008 08:27 PM

This looks like what you want:
http://www.captain.at/howto-rsync-linux-windows.php
http://www.brentnorris.net/rsyncntdoc.html

kenoshi 07-29-2008 11:08 AM

Just install cygwin on your windows box. Make sure the following are installed:

- All packages in admin
- unzip/zip from archive
- select vim in editors
- in Net, select openssh client/server, then rsync
- everything else default

Once cygwin is finished, open the cygwin bash shell, and run:

ssh-host-config

Say yes to everything and follow instructions to start the service.

Voila, you are all set. If you still get the same error, make sure you specify where rsync is remotely with the following option:

--rsync-path=<path to rsync on windows box>

Hope this helps.

alberto56 11-26-2013 09:56 AM

In my case I was trying to rsync from Mac OS to CentOS. rsync has to be installed on the remote box, but it is expected to be at /usr/sbin/rsync instead of /usr/bin/rsync. I just created a symlink on my remote machine:

ln -s /usr/bin/rsync /usr/sbin/rsync

Now rsync works

AlucardZero 11-26-2013 06:16 PM

Instead of making a symlink (though it works), you can use the --rsync-path switch:
Code:

--rsync-path=PROGRAM    specify the rsync to run on remote machine

shashaness 09-23-2016 11:03 AM

Rsync is required on both ends
 
Working on a new mail server install, when I tried to copy the information from the old server using rsync via ssh I got the same error.

Installed rsync on new machine..... error went away. It makes sense that you need rsync on both based on the fact that it uses a specific algorithm to determine file changes.

Quote:

The rsync utility uses an algorithm invented by Australian computer programmer Andrew Tridgell for efficiently transmitting a structure (such as a file) across a communications link when the receiving computer already has a similar, but not identical, version of the same structure.

The recipient splits its copy of the file into chunks and computes two checksums for each chunk: the MD5 hash, and a weaker but easier to compute 'rolling checksum'.[18] It sends these checksums to the sender.
-- https://en.wikipedia.org/wiki/Rsync

IsaacKuo 09-23-2016 01:28 PM

There's a simple way to use rsync when it is only installed on one side - mount the other side's relevant file system as a file share (sshfs, or nfs, or samba, or whatever), and then use rsync to copy files to/from that file share.

I like using rsync in this fashion because the other side doesn't need any special setup other than serving up a file share.

The only real downside to having rsync only on one side is that you can't conserve bandwidth by doing binary checksum comparison. You have to rely entirely upon timestamp/filesize to detect unchanged files. IMHO, this is not a big deal. I mean, what are the chances that a file is going to have its timestamp altered but the contents remain the same?

Okay, depending on the file share and file system involved, this could happen a LOT. In particular, there are Windows issues with daylight savings time, and Windows file systems don't have the same timestamp granularity as *nix. You can work around the latter by using a slop range of a couple seconds, but daylight savings time is ... annoying.


All times are GMT -5. The time now is 03:19 AM.