热门IT资讯网

5分钟入门lsyncd

发表于:2024-06-02 作者:热门IT资讯网编辑
编辑最后更新 2024年06月02日,5分钟入门lsyncdlsyncd 是基于lua封装的inotify + rsynclsyncd installyum install -y gcc gcc-c++ make camke lua lu

5分钟入门lsyncd

lsyncd 是基于lua封装的inotify + rsync

lsyncd install

yum install -y gcc gcc-c++ make camke lua lua-develgit clone https://github.com/axkibe/lsyncd.gitcmake .makesudo make install

lsyncd config

settings {    logfile = "/var/log/lsyncd.log",    statusFile = "/var/log/lsyncd-status.log",    statusInterval = 20}sync {   default.rsyncssh,   source="/srcdir",   host="remotehost",     exclude = { '*.bak' , '*.tmp' },   excludeFrom="/etc/lsyncd.exclude",   targetdir="/dstdir",   rsync = {     archive = true,     compress = false,     whole_file = false   },   ssh = {     port = 1234   }}

lsyncd use

lsyncd -rsync /home/USER/src /home/USER/dstlsyncd -rsync /home/USER/src remotehost:dstlsyncd -rsync /home/USER/src remotehost1:dst -rsync /home/USER/src remotehost2:dst lsyncd -rsyncssh /home/USER/src REMOTEHOST TARGETDIRlsyncd -nodaemon CONFIGFILElsyncd -log all CONFIGFILE
0