rsync'ing 两个远程服务器之间的文件,得到错误,说明在远程服务器上找不到 rsync 命令 [英] rsync'ing files between two remote servers, get errors stating rsync command not found on remote server
问题描述
我正在尝试使用
rsync -avlzp /source user@server:/destination
但我收到错误说明
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(635) [sender=3.0.2]
但 rsync 安装在两台服务器上.我究竟做错了什么?我也试过
but rsync is installed on both servers. What am I doing wrong? I've also tried
rsync -av -e "ssh -l ssh-user" /source server:/destination
结果相同.
我主要是尝试使用 rsync 以便它只复制存在的差异...
I'm mainly trying to use rsync so that it only copies over differences if they exist...
谢谢
推荐答案
运行交互式 shell 时,rsync 可能位于远程计算机上的路径中,但在通过 ssh(使用非交互式 shell)运行 rsync 时则不然.例如,.bashrc 通常只针对交互式 shell 运行,因此如果您的路径在那里定义,则在远程端运行 rsync --server
时不会解析它.试试/etc/profile.有关详细信息,请参阅 bash(1).
rsync may be in the path on the remote machine when running an interactive shell, but not when running rsync by ssh (with a non-interactive shell). .bashrc is normally only run for interactive shells, for example, so if your path is defined there, it will not be parsed when running rsync --server
on the remote end. Try /etc/profile. See bash(1) for more details.
您可以使用--rsync-path
指定远程机器上 rsync 二进制文件的路径.
You can use --rsync-path
to specify the path to the rsync binary on the remote machine.
这篇关于rsync'ing 两个远程服务器之间的文件,得到错误,说明在远程服务器上找不到 rsync 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!