linux - rsync 守护进程行为异常

标签 linux ubuntu daemon rsync

我正在运行一个 rsync 守护进程(为 SaneSecurity 签名提供一个镜像)。

rsync 是这样启动的(来自 runit):

    /usr/bin/rsync -v --daemon --no-detach

配置包含:

    use chroot = no
    munge symlinks = no
    max connections = 200
    timeout = 30
    syslog facility = local5
    transfer logging = no
    log file = /var/log/rsync.log
    reverse lookup = no
    [sanesecurity]
      comment = SaneSecurity ClamAV Mirror
      path = /srv/mirror/sanesecurity
      read only = yes
      list = no
      uid = nobody
      gid = nogroup

但我看到的是很多“挥之不去”的 rsync 进程:

   # ps auxwww|grep rsync
   root       423  0.0  0.0   4244  1140 ?        Ss   Oct30   0:00 runsv rsync
   root      2529  0.0  0.0  11156  2196 ?        S    15:00   0:00 /usr/bin/rsync -v --daemon --no-detach
   nobody    4788  0.0  0.0  20536  2860 ?        S    15:10   0:00 /usr/bin/rsync -v --daemon --no-detach
   nobody    5094  0.0  0.0  19604  2448 ?        S    15:13   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      5304  0.0  0.0  11156   180 ?        S    15:15   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      5435  0.0  0.0  11156   180 ?        S    15:16   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      5797  0.0  0.0  11156   180 ?        S    15:19   0:00 /usr/bin/rsync -v --daemon --no-detach 
   nobody    5913  0.0  0.0  20536  2860 ?        S    15:20   0:00 /usr/bin/rsync -v --daemon --no-detach
   nobody    6032  0.0  0.0  20536  2860 ?        S    15:21   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      6207  0.0  0.0  11156   180 ?        S    15:22   0:00 /usr/bin/rsync -v --daemon --no-detach
   nobody    6292  0.0  0.0  20544  2744 ?        S    15:23   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      6467  0.0  0.0  11156   180 ?        S    15:25   0:00 /usr/bin/rsync -v --daemon --no-detach
   root      6905  0.0  0.0  11156   180 ?        S    15:29   0:00 /usr/bin/rsync -v --daemon --no-detach

(现在是 15:30)

所以从 15:10、15:13 等时间开始就有进程(甚至没有放弃特权!)。

他们在做什么?

让我们检查一下:

    # strace -p 5304
    strace: Process 5304 attached
    select(4, [3], NULL, [3], {25, 19185}^C
    strace: Process 5304 detached
    <detached ...>

    # strace -p 5797
    strace: Process 5797 attached
    select(4, [3], NULL, [3], {48, 634487}^C
    strace: Process 5797 detached
    <detached ...>

这发生在 Ubuntu Xenial 的 rsync 和 PPA 安装(当前使用 rsync 3.1.2-1~ubuntu16.04.1york0)

最佳答案

为每个连接创建一个进程。在客户端选择模块之前,进程不知道它是否应该放弃特权。

您可以轻松创建这样的流程。

nc $host 873

您会注意到连接在 30 秒后不会关闭,因为超时只是磁盘 i/o 超时。 rsync 客户端有一个 --contimeout 选项,但似乎缺少服务器端选项。

关于linux - rsync 守护进程行为异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41041983/

相关文章:

java - Netbeans 8.0 全新安装无法静默启动

linux - 在Eclipse中设置Qt的Bin路径

c++ - setsockopt 正在尝试将 IGMP 数据包发送到接口(interface)关闭

c - C 中的守护进程 - 有没有一种方法可以实现它们?

php - 调用正在运行的程序并在 php 中获得响应

linux - Linux 中# 符号后运行命令

Android studio 无法在 Ubuntu 上安装

linux - WKHTMLTOPDF 在 Ubuntu 上安装错误

terminal - 在 Lubuntu (Utopic Unicorn) 上安装 VLC

Python 线程定时器初始守护进程