Centos7安装Lsyncd
1. 安装lsyncd依赖包 yum install lua lua-devel pkgconfig gcc asciidoc 2. 安装lsyncd rpm资源,并安装lsyncd rpm -iUvh http://mirror.centos.org/centos/7/extras/x86_64/Packages/epel-release-7-9.noarch.rpm yum install lsyncd 3.配置lsyncd 4. 复制lsyncd配置文件 cp /usr/share/doc/lsyncd-2.1.5/examples/lrsync.lua /etc/lsyncd.conf 5. 编辑lsyncd配置文件 vim /etc/lsyncd.conf ---- -- User configuration file for lsyncd. -- -- Simple example for default rsync. -- settings { logfile ="/var/log/lsyncd.log", statusFile = "/tmp/lsyncd.stat", statusInterval = 1, } sync { default.rsync, source="/usr/blues/", target="192.168.16.144::backup", rsync = { rsh ="/usr/bin/ssh -l root -i /root/.ssh/id_rsa", binary = "/usr/bin/rsync", archive = true, compress = true, verbose = true } } 6.启动服务,并设置开机启动 1). 启动lsyncd服务 systemctl start lsyncd 2). 启动完成查看lsyncd状态,确保lsync启动成功 systemctl status lsyncd 3). 设置开机启动 systemctl enable lsyncd
———————————————————————————————-
Debian 8安装lsyncd:
环境安装: apt-get install luarocks apt-get install lua-socket apt-get install lua-filesystem apt-get install -y lua5.1 liblua5.1-dev pkg-config rsync asciidoc #lfs和sockets用来调试,luarocks用来安装别的模块的开发环境,intellij idea的社区版+lua插件 apt-get install lsyncd mkdir /etc/lsyncd touch /etc/lsyncd/lsyncd.conf.lua mkdir /var/log/lsyncd touch /var/log/lsyncd/lsyncd.{log,status} vim /etc/lsyncd/lsyncd.conf.lua 配置文件: ---- -- User configuration file for lsyncd. -- -- Simple example for default rsync. -- settings { logfile ="/var/log/lsyncd.log", statusFile = "/tmp/lsyncd.stat", statusInterval = 1, } sync { default.rsync, source="/usr/blues/", target="192.168.16.144::backup", rsync = { rsh ="/usr/bin/ssh -l root -i /root/.ssh/id_rsa", binary = "/usr/bin/rsync", archive = true, compress = true, verbose = true } } 启动lsyncd: service lsyncd restart