我正在尝试通过 Windows 上的 cygwin 确保两台机器之间的 rsync 文件传输安全。
rsync 创建的所有日志文件的位置在哪里?我目前正在使用
rsync -e ssh -avzP --delete "/cygdrive/C/secure/data/" "/cygdrive/D/data" --log-file=/cygdrive/C/secure/log/c.log
当 rsync 启动时,它说“构建文件列表”是在内存中完成的还是在某处写入临时文件?
最佳答案
您询问“构建文件列表...”是发生在内存中,还是存储在某处。我们来看看rsync's sources ,即 flist.c
:
2089 rprintf(FLOG, "building file list\n");
2090 if (show_filelist_p())
2091 start_filelist_progress("building file list");
2092 else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server)
2093 rprintf(FCLIENT, "sending incremental file list\n");
2094
2095 start_write = stats.total_written;
2096 gettimeofday(&start_tv, NULL);
2097
2098 if (relative_paths && protocol_version >= 30)
2099 implied_dirs = 1; /* We send flagged implied dirs */
2100
2101 #ifdef SUPPORT_HARD_LINKS
2102 if (preserve_hard_links && protocol_version >= 30 && !cur_flist)
2103 init_hard_links();
2104 #endif
2105
2106 flist = cur_flist = flist_new(0, "send_file_list");
2107 if (inc_recurse) {
2108 dir_flist = flist_new(FLIST_TEMP, "send_file_list");
2109 flags |= FLAG_DIVERT_DIRS;
2110 } else
2111 dir_flist = cur_flist;
flist_new
只是分配一个新的文件列表池,什么都不做。字符串参数用于通知内存不足错误。
然后有几百行,目的是发送文件列表。除了可能的错误消息外,那里没有任何 rprintf
调用。该循环中最有趣的函数调用是对 send_file_name
的调用,但这些调用也不会调用 rprintf
。
所以是的,它在内存中构建文件,如果您不自己修补源代码就无法记录它。此外,并非 rsync 中的所有内容都记录到日志文件中,有些消息会直接打印到您的屏幕上。事实上,根据您的进度设置,使用简单的 shell 重定向可能会更好。 (或者使用 tee
将输出同时打印到文件和标准输出。)
关于windows - cygwin rsync 所有日志位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18688487/