如何解决rsync错误的错误:pipe.c(85)处IPC代码(代码14)中的错误[sender = 3.1.2] [英] How to solve the error of the rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.2]

查看:685
本文介绍了如何解决rsync错误的错误:pipe.c(85)处IPC代码(代码14)中的错误[sender = 3.1.2]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用rsync命令创建一个用于保存图像的新目录,该命令为"rsync -ave --rsync-path='mkdir -p " + path + " && rsync' " + filePath + " ubuntu@" + LocalhostIp + ":" + path,但是在运行我的代码时,此命令将给我错误信息,错误是

I'm using a command of rsync for making a new directory to save the images the command is "rsync -ave --rsync-path='mkdir -p " + path + " && rsync' " + filePath + " ubuntu@" + LocalhostIp + ":" + path but while running my code this command will gives me the error the error is

错误:

退出状态14:rsync:执行失败--rsync-path = mkdir:没有此类文件或目录(2)

exit status 14: rsync: Failed to exec --rsync-path=mkdir: No such file or directory (2)

rsync错误:pipe.c(85)[sender = 3.1.2]处IPC代码(代码14)错误

rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.2]

rsync:连接意外关闭(到目前为止已收到0个字节)[发送方]

rsync: connection unexpectedly closed (0 bytes received so far) [sender]

rsync错误:io.c(235)[sender = 3.1.2]处IPC代码(代码14)错误

rsync error: error in IPC code (code 14) at io.c(235) [sender=3.1.2]

修改

func CopyUploadedFileToAppServers(filePath, path string) {
   ExecuteCommand("rsync -ave --rsync-path='mkdir -p " + path + " && rsync' " + filePath + " ubuntu@" + LocalhostIp + ":" + path)
}

func ExecuteCommand(command string) error{
 cmd := exec.Command("sh", "-c",command)
 var out bytes.Buffer
 var stderr bytes.Buffer
 cmd.Stdout = &out
 cmd.Stderr = &stderr

 err := cmd.Run()

 if err != nil {
    fmt.Println(fmt.Sprint(err) + ": " + stderr.String())
    return err
 }
 fmt.Println("Result: " + out.String())
 return nil
}

如何解决此错误?

推荐答案

您需要删除-e选项,因为这需要以下工作(--rsync-path=...)代替ssh命令.例如

You need to remove the -e option, as this is taking the following work (--rsync-path=...) as the replacement for the ssh command. For example,

$ rsync -ave --x_x  /tmp/a abc@localhost:/tmp/y
rsync: Failed to exec --x_x: No such file or directory (2)

只需使用-av.

这篇关于如何解决rsync错误的错误:pipe.c(85)处IPC代码(代码14)中的错误[sender = 3.1.2]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆