我真的被难住了 - 我花了将近两个小时来寻找一个非常简单的问题的答案:如何在我的 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"
}
}
Run Code Online (Sandbox Code Playgroud)
它只是说“无需同步”。帮助?
小智 1
在 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,
}
Run Code Online (Sandbox Code Playgroud)
启动 lsyncd 后我有下一个
root@localhost:/srcdir# ls
12 aster asterisk
root@localhost:/dstdir# ls
asterisk
Run Code Online (Sandbox Code Playgroud)