我想将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都使用相同版本的rsync托pipe在Amazon上。
更新:我已经试过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

我有完全相同的问题,我的解决scheme是我从来没有想过的。 在我的情况下, rsync一直工作得很好,直到它在一些testing中停止后,改变了我的一个脚本。 罪魁祸首是我目前login的UNIX用户在一个已经被脚本删除的不存在的文件夹中。
getcwd(): No such file or directory (2)错误消息与$PWD有关, 而不是源, 而不是目的地。
只要将文件夹改为现有的文件夹(例如cd ~ ),然后重新运行该脚本即可。 如果它们不是绝对的,请不要忘记更改rsyncpath。