5分钟入门lsyncd

5分钟入门lsyncd

lsyncd 是基于lua封装的inotify + rsync

创新互联主要从事成都网站设计、做网站、成都外贸网站建设公司、网页设计、企业做网站、公司建网站等业务。立足成都服务洞头,10年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792

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

文章名称:5分钟入门lsyncd
文章链接:http://cdiso.cn/article/ieddjo.html

其他资讯