千家信息网

5分钟入门lsyncd

发表于:2024-10-10 作者:千家信息网编辑
千家信息网最后更新 2024年10月10日,5分钟入门lsyncdlsyncd 是基于lua封装的inotify + rsynclsyncd installyum install -y gcc gcc-c++ make camke lua lu
千家信息网最后更新 2024年10月10日5分钟入门lsyncd

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