码迷,mamicode.com
首页 > 其他好文 > 详细

5分钟入门lsyncd

时间:2020-02-17 09:25:29      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:from   file   res   lock   lse   css   getdir   srcdir   remote   

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

5分钟入门lsyncd

标签:from   file   res   lock   lse   css   getdir   srcdir   remote   

原文地址:https://blog.51cto.com/justinit/2471438

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!