linux – rsync:getcwd():没有这样的文件或目录(2)

我想将Server1和Server2的日志同步到LogServer.

对于Server1:

rsync -avz -e 'ssh -p 2188' user@server1:/usr/local/servers/logs/* /usr/local/logs/

这个适用,但对于Server2:

rsync -avz -e 'ssh -p 2188' user@server2:/usr/local/servers/logs/* /usr/local/logs/

它失败:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory
rsync: getcwd(): No such file or directory (2)
rsync error: errors selecting input/output files,dirs (code 3) at util.c(992) [sender=3.0.6]
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [receiver=3.0.6]

Server1和Server2都在Amazon上托管,具有相同版本的rsync.

我很确定命令中的每个目录都存在.我怎么解决这个问题?

更新:我已经尝试过ssh -p 2188 user @ server2 pwd,它不起作用:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory

job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: no such file or directory

截图

解决方法

我有完全相同的问题,我的解决方案是我从未想过的.在我的情况下,rsync一直运行良好,直到在我的一个脚本更改后在某些测试期间停止.罪魁祸首是我当前登录的UNIX用户位于一个已经被脚本删除的不存在的文件夹中.

getcwd():没有这样的文件或目录(2)错误消息与$PWD有关,而不是源,而不是目的地.

只需将文件夹更改为现有文件夹(例如cd~)并重新运行该脚本.如果rsync路径不是绝对路径,请不要忘记更改它们.

相关文章

1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...
1 删除0字节文件 find -type f -size 0 -exec rm -rf {} ...
## 步骤 1:安装必要的软件包 首先,需要确保系统已安装 `dh...