linux – rsync:getcwd():没有这样的文件或目录(2)
发布时间:2020-12-13 18:37:23 所属栏目:Linux 来源:网络整理
导读:我想将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
我想将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路径不是绝对路径,请不要忘记更改它们. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |