我有一個rsync進程運行,我可以成功執行以下命令:的Rsync通過的posix_spawn
的rsync --port = 1873年-avWh 127.0.0.1::jackfruit_peers/data.0a6 /家庭/ V /數據
但是從代碼:
local_dir = /家庭/ v /數據
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: failed to connect to 127.0.0.1 (127.0.0.1): Connection refused (111) rsync error: error in socket IO (code 10) at clientserver.c(128) [Receiver=3.1.0] 2015-01-16 15:27:08.421.732 28623 0x7fbc01914010 INFO Waking up parent whose child pid=30060. errno=0
任何想法,爲什麼?
編輯:rsync的手柄被定義爲:
[jackfruit_peers]
comment = for data transfer
path = /home/jackfruit/
read only = yes
timeout = 60