5分钟入门lsyncd

5分钟入门lsyncd

lsyncd 是基于lua封装的inotify + rsync

lsyncd install

yum install -y gcc gcc-c++ make camke lua lua-devel

git clone https://github.com/axkibe/lsyncd.git

cmake .
make
sudo 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/dst
lsyncd -rsync /home/USER/src remotehost:dst
lsyncd -rsync /home/USER/src remotehost1:dst -rsync /home/USER/src remotehost2:dst 
lsyncd -rsyncssh /home/USER/src REMOTEHOST TARGETDIR

lsyncd -nodaemon CONFIGFILE
lsyncd -log all CONFIGFILE

原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/182336.html

(0)
上一篇 2021年11月1日
下一篇 2021年11月1日

相关推荐

发表回复

登录后才能评论