我有rsyncd作为
Windows服务运行,但是当我尝试访问模块并从中同步时,我得到了我想要的文件,以及我不想要的文件 – 因为它们不在远程的那个模块中结束.为了测试,我只将一个文件放在备份文件夹中,名为“the_only_file”.从我的本地机器:
username@local:~$rsync username@remote::backup . receiving incremental file list file has vanished: "/proc" (in backup) file has vanished: "/cygdrive/c" (in backup) file has vanished: "/cygdrive/d" (in backup) skipping non-regular file "dev/clipboard" skipping non-regular file "dev/conin" skipping non-regular file "dev/conout" skipping non-regular file "dev/console" skipping non-regular file "dev/dsp" skipping non-regular file "dev/full" skipping non-regular file "dev/kmsg" skipping non-regular file "dev/null" skipping non-regular file "dev/ptmx" skipping non-regular file "dev/pty0" skipping non-regular file "dev/random" skipping non-regular file "dev/scd0" skipping non-regular file "dev/sda" skipping non-regular file "dev/sda1" skipping non-regular file "dev/sda2" skipping non-regular file "dev/sr0" skipping non-regular file "dev/tty" skipping non-regular file "dev/urandom" skipping non-regular file "dev/windows" skipping non-regular file "dev/zero" ./ the_only_file cygdrive/ dev/ sent 70 bytes received 613 bytes 455.33 bytes/sec total size is 0 speedup is 0.00 rsync warning: some files vanished before they could be transferred (code 24) at main.c(1708) [generator=3.1.0] username@local:~$ls cygdrive dev the_only_file
我在cygwin中使用以下命令来创建服务:
cygrunsrv --install "rsyncd" --path "$(which rsync)" --args "--daemon --no-detach" --desc "Starts rsync daemon to accept rsync connections" --disp "rsync daemon" --type "auto"
我的rsyncd.conf非常简单:
chroot = yes charset = UTF-8 log file = /var/log/rsyncd.log [backup] uid = username secrets file = /cygdrive/c/cygwin/etc/rsyncd.secrets auth users = username path = /cygdrive/c/Users/username/backup list = false readonly = false dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz *.7z
我能做些什么来让Cygwin的rsyncd表现得像它应该的那样? (为什么它会尝试向我发送/ proc目录?太奇怪……)
解决方法
我通过我不想做的方式“解决”了这个问题:我在rsyncd.conf中添加了以下行:
exclude from = /cygdrive/c/cygwin/etc/rsyncd.exclude
rsyncd.exclude是:
- /dev/* - /dev - /cygdrive/* - /cygdrive - /proc
现在它按预期工作,但需要注意的是,这意味着我不能在我的共享的根目录中拥有名为“dev”,“proc”或“cygdrive”的目录/文件.对大多数人来说可能并不重要;有一个“cygdrive”或“proc”文件夹会让人感到困惑,但可以说一个论点是devs的文件夹会被称为“dev”或类似的东西.再次,似乎有些轻微,也许大多数人都不在乎.