我想防止我的robots.txt文件同步到前端服务器。这是我的/etc/lsyncd.conf文件:
settings = {
logfile = "/tmp/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
statusInterval = 1,
}
sync{
default.rsync,
source="/var/www/html/blog",
target="sync:/var/www/html/blog",
rsyncOpts="-ltus",
excludeFrom="/var/www/html/blog/robots.txt",
}/tmp/lsyncd.log告诉
Normal: recursive startup rsync: /var/www/html/blog/ -> sync:/var/www/html/blog/ excluding
HELLO WORLD
Normal: Startup of '/var/www/html/blog/' finished.
Normal: Calling rsync with filter-list of new/modified files/dirs
/robots.txt
/
Normal: Finished a list = 0这个设置似乎没有效果。
发布于 2013-08-27 07:09:58
我猜excludeFrom dir是相对于source dir的;因此,excludeFrom="/robots.txt"可能会工作。
编辑:哦,天哪,忘了我上面写的。excludeFrom是一个rsync参数,它指定一个文本文件,其中包含要排除的文件列表、每行一个文件或模式。因此,您的excludeFrom应该包含一个文件的路径,然后该路径包含这个/var/www/html/blog/robots.txt或/robots.txt。
发布于 2016-06-20 11:52:38
使用rsync's --exclude指令在lsyncd's配置参数rsyncOpts,或_extra,这取决于您使用的lsyncd版本。
发布于 2016-08-17 20:56:10
根据https://axkibe.github.io/lsyncd/manual/config/layer4/:
excludeFrom是文件名参数,在每行规则上从该文件加载排除规则。
请注意,https://community.rackspace.com/general/f/34/t/3503:
注意!当使用excludeFrom和文件时,确保文件中没有空行。如果是这样的话,lsyncd就会将其视为“this /”,然后一切都会被排除在外。
https://serverfault.com/questions/534030
复制相似问题