Woo*_*aaa 12 linux ssh shell rsync
我想将Server1
和Server2
的日志同步到LogServer
.
对于Server1
:
rsync -avz -e 'ssh -p 2188' user@server1:/usr/local/servers/logs/* /usr/local/logs/
Run Code Online (Sandbox Code Playgroud)
这个有效,但对于Server2
:
rsync -avz -e 'ssh -p 2188' user@server2:/usr/local/servers/logs/* /usr/local/logs/
Run Code Online (Sandbox Code Playgroud)
它失败:
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]
Run Code Online (Sandbox Code Playgroud)
双方Server1
并Server2
托管在亚马逊具有相同版本的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
Run Code Online (Sandbox Code Playgroud)
Raf*_*ski 36
我有完全相同的问题,我的解决方案是我从未想过的。在我的情况下,它rsync
一直运行良好,直到在更改我的一个脚本后在某些测试中停止。罪魁祸首是我当前登录的 UNIX 用户位于已被脚本删除的不存在的文件夹中。
该getcwd(): No such file or directory (2)
错误消息是有关$PWD
,不源,而不是目标。
只需将文件夹更改为现有文件夹(例如cd ~
)并重新运行脚本。rsync
如果路径还不是绝对路径,请不要忘记更改路径。
归档时间: |
|
查看次数: |
14148 次 |
最近记录: |