加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 为什么rsync会为我生成多个进程?

发布时间:2020-12-13 18:28:05 所属栏目:Linux 来源:网络整理
导读:我使用以下cron语句从一个文件夹备份到同一台机器中的另一个文件夹: 19 21 * * * root rsync -ac --delete /source/folder /dest/folder 当我使用pstree时,我看到cron分叉了三个进程 ├─cron───cron───rsync───rsync───rsync 和ps 9972 ? Ds 1
我使用以下cron语句从一个文件夹备份到同一台机器中的另一个文件夹:
19 21 * * * root  rsync -ac --delete /source/folder /dest/folder

当我使用pstree时,我看到cron分叉了三个进程

├─cron───cron───rsync───rsync───rsync

和ps

9972 ?        Ds     1:00 rsync -ac --delete /source/folder /dest/folder
 9973 ?        S      0:29 rsync -ac --delete /source/folder /dest/folder
 9974 ?        S      0:09 rsync -ac --delete /source/folder /dest/folder

为什么有三个流程?我可以只限一个吗?

解决方法

http://rsync.samba.org/how-rsync-works.html

Rsync is heavily pipelined. This means that it is a set of processes that communicate in a (largely) unidirectional way. Once the file list has been shared the pipeline behaves like this:
generator → sender → receiver

The output of the generator is input for the sender and the output of the sender is input for the receiver. Each process runs independently and is delayed only when the pipelines stall or when waiting for disk I/O or CPU resources.

您正在运行本地rsync(源和目标是本地文件系统),因此所有三个进程都将在那里运行.你无能为力,这是设计的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读