C语言学习网

5分钟入门lsyncd

发表于:2022-08-13 作者:安全数据网编辑
编辑最后更新 2022年08月13日,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