【发布时间】:2015-01-16 10:00:09
【问题描述】:
我有一个 rsync 守护进程正在运行,我可以成功执行以下命令:
rsync --port=1873 -avWh 127.0.0.1::jackfruit_peers/data.0a6 /home/v/data
但从代码来看:
local_dir = /home/v/data
remote_dir = 127.0.0.1::jackfruit_peers/data.0a6
pid_t child_pid;
char cmd[] = "rsync -avWh --port=1873";
char *argv[] = {cmd, remote_dir, local_dir,
(char*) 0};
if (0 != posix_spawn(&child_pid, "/usr/bin/rsync", NULL, NULL, argv, environ)) {
logger::error("posix spawn");
return ERR_INTERNAL_SERVER_ERROR;
}
我得到错误:
rsync:无法连接到 127.0.0.1 (127.0.0.1):连接被拒绝 (111) rsync 错误:clientserver.c(128) 处的套接字 IO(代码 10)错误 [接收方=3.1.0] 2015-01-16 15:27:08.421.732 28623 0x7fbc01914010 信息 唤醒孩子 pid=30060 的父母。错误号=0
知道为什么吗?
编辑:rsync 句柄定义为:
[jackfruit_peers]
comment = for data transfer
path = /home/jackfruit/
read only = yes
timeout = 60
【问题讨论】: