1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| settings { logfile ="/var/log/lsyncd/lsyncd.log", statusFile ="/var/log/lsyncd/lsyncd.status", inotifyMode = "CloseWrite", maxProcesses = 8, -- nodaemon = false, }
-- 远程目录同步,rsync模式 + ssh shell
sync { default.rsync, -- 同步源目录(本机某个目录,必须保证该文件或目录在源服务器上存在,不然启动会报错) source = "/etc/coredns/", -- 同步目标地址和目标目录,注意target如果是普通需要有写权限,以上是将源服务器上/oafiles/目录下的所有文件同步到目标服务器的/hdd/test目录下 target = "root@10.113.75.19:/etc/coredns", -- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst", maxDelays = 1, delay = 15, rsync = { binary = "/usr/bin/rsync", archive = true, compress = true, verbose = true } -- 在文件同步完成后执行的命令 postcmd = "/usr/bin/systemctl restart coredns" }
|