[英]Is it possible to sync just ONE file with lsyncd?
我真的很难过 - 我花了将近两个小时的时间来寻找一个简单易懂的问题的答案:我如何在Mac上不断保持两个本地文件的同步? 我研究了涉及rsync
各种技巧,然后决定使用lsyncd
。
但对于我的生活,我无法弄清楚如何让lsyncd
同步两个特定的文件。 API甚至支持这个吗? 文档中不清楚我是否可以这种方式使用rsync
; 我假设lsyncd
正在传递阻止这种情况的CLI选项。 我的配置如下:
sync = {
default.rsync,
source = "/Users/username/Downloads/test1.txt",
target = "/Users/username/Downloads/test2.txt",
rsync = {
binary = "/usr/local/bin/rsync",
archive = "true"
}
}
它只是说“无需同步”。 救命?
在lsynd你可以这样做
settings {
logfile = "/var/log/lsyncd.log",
statusFile = "/var/log/lsyncd-status.log",
statusInterval = 20,
nodaemon = true
}
sync {
default.rsync,
source="/srcdir/",
target="/dstdir/",
rsync = {
archive = true,
compress = true,
whole_file = false,
_extra = { "--include=asterisk", "--exclude=*" },
verbose = true
},
delay=5,
log=all,
}
启动后lsyncd我有下一个
root@localhost:/srcdir# ls
12 aster asterisk
root@localhost:/dstdir# ls
asterisk
这对我有用:
sync {
default.rsync,
source = "/Users/username/Downloads/",
target = "/Users/username/Downloads/",
rsync = {
binary = "/usr/bin/rsync",
archive = "true",
_extra = {
"--include=test1.txt",
"--exclude=*"
}
}
}
您必须使用lsyncd的包含/排除功能,它不是开箱即用的。 您必须使用_extra字段来设置它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.